﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Assist;
using Autodesk.Revit.ApplicationServices;
using Autodesk.Revit.Creation;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using Autodesk.Revit.UI.Selection;
using YArchitech.Revit;
using YArchitech.Revit.RevitExtension;

namespace HangerSupport
{
	public class HSFamily
	{
		public static double mmToFeet(double mmVal)
		{
			return mmVal / 304.8;
		}

		public static double feetToMM(double feetVal)
		{
			return feetVal * 304.8;
		}

		public static XYZ Rotate(XYZ vect, XYZ axis, double angle)
		{
			double x = axis.X;
			double y = axis.Y;
			double z = axis.Z;
			double[,] array = new double[3, 3];
			array[0, 0] = x * x;
			array[0, 1] = x * y;
			array[0, 2] = x * z;
			array[1, 0] = y * x;
			array[1, 1] = y * y;
			array[1, 2] = y * z;
			array[2, 0] = z * x;
			array[2, 1] = z * y;
			array[2, 2] = z * z;
			double[,] array2 = array;
			double[,] array3 = new double[3, 3];
			array3[0, 1] = -z;
			array3[0, 2] = y;
			array3[1, 0] = z;
			array3[1, 2] = -x;
			array3[2, 0] = -y;
			array3[2, 1] = x;
			double[,] array4 = array3;
			double[,] array5 = new double[3, 3];
			array5[0, 0] = 1.0 - array2[0, 0];
			array5[0, 1] = -array2[0, 1];
			array5[0, 2] = -array2[0, 2];
			array5[1, 0] = -array2[1, 0];
			array5[1, 1] = 1.0 - array2[1, 1];
			array5[1, 2] = -array2[1, 2];
			array5[2, 0] = -array2[2, 0];
			array5[2, 1] = -array2[2, 1];
			array5[2, 2] = 1.0 - array2[2, 2];
			double[,] array6 = array5;
			double[,] array7 = new double[3, 3];
			array7[0, 0] = array2[0, 0] + Math.Cos(angle) * array6[0, 0] + Math.Sin(angle) * array4[0, 0];
			array7[0, 1] = array2[0, 1] + Math.Cos(angle) * array6[0, 1] + Math.Sin(angle) * array4[0, 1];
			array7[0, 2] = array2[0, 2] + Math.Cos(angle) * array6[0, 2] + Math.Sin(angle) * array4[0, 2];
			array7[1, 0] = array2[1, 0] + Math.Cos(angle) * array6[1, 0] + Math.Sin(angle) * array4[1, 0];
			array7[1, 1] = array2[1, 1] + Math.Cos(angle) * array6[1, 1] + Math.Sin(angle) * array4[1, 1];
			array7[1, 2] = array2[1, 2] + Math.Cos(angle) * array6[1, 2] + Math.Sin(angle) * array4[1, 2];
			array7[2, 0] = array2[2, 0] + Math.Cos(angle) * array6[2, 0] + Math.Sin(angle) * array4[2, 0];
			array7[2, 1] = array2[2, 1] + Math.Cos(angle) * array6[2, 1] + Math.Sin(angle) * array4[2, 1];
			array7[2, 2] = array2[2, 2] + Math.Cos(angle) * array6[2, 2] + Math.Sin(angle) * array4[2, 2];
			double[,] array8 = array7;
			return new XYZ(array8[0, 0] * vect.X + array8[0, 1] * vect.Y + array8[0, 2] * vect.Z, array8[1, 0] * vect.X + array8[1, 1] * vect.Y + array8[1, 2] * vect.Z, array8[2, 0] * vect.X + array8[2, 1] * vect.Y + array8[2, 2] * vect.Z);
		}

		public static bool CreateHSTemplateDirectory(string strDir)
		{
			bool flag = Directory.Exists(strDir);
			bool result;
			if (flag)
			{
				result = true;
			}
			else
			{
				DirectoryInfo directoryInfo = Directory.CreateDirectory(strDir);
				result = true;
			}
			return result;
		}

		public HSFamily(UIApplication uiApp)
		{
			this.m_uiApp = uiApp;
			this.m_doc = this.m_uiApp.ActiveUIDocument.Document;
			this.m_selection = this.m_uiApp.ActiveUIDocument.Selection;
			this.m_revit = this.m_uiApp.Application;
			this.m_strHSFamilyDir = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "\\";
			this.m_strFamilyTemplatePath = this.m_uiApp.Application.FamilyTemplatePath;
			bool flag = this.m_strFamilyTemplatePath.Length > 0;
			if (flag)
			{
				this.m_strSectionTemplatePath = this.m_strFamilyTemplatePath;
				int num = this.m_strFamilyTemplatePath.IndexOf("Autodesk");
				bool flag2 = num > 0;
				if (flag2)
				{
					this.m_strHSFamilyDir = this.m_strFamilyTemplatePath.Substring(0, num);
					this.m_strFamilyTemplatePath += HSFamily.m_strHSTemplateName;
					this.m_strSectionTemplatePath += HSFamily.m_strSectionTemplateName;
				}
			}
			this.m_strHSFamilyDir += "Hongye\\HYStructure\\";
			bool flag3 = !File.Exists(this.m_strFamilyTemplatePath);
			if (flag3)
			{
				this.m_strFamilyTemplatePath = Utils.GetTemplateDir(this.m_uiApp) + HSFamily.m_strHSTemplateName;
			}
			bool flag4 = !File.Exists(this.m_strSectionTemplatePath);
			if (flag4)
			{
				this.m_strSectionTemplatePath = Utils.GetTemplateDir(this.m_uiApp) + HSFamily.m_strSectionTemplateName;
			}
			this.m_strLabelTemplatePath = Utils.GetTemplateDir(this.m_uiApp) + HSFamily.m_strLabelTemplateName;
			HSFamily.CreateHSTemplateDirectory(this.m_strHSFamilyDir);
			this.m_dElevationLevelUp = 0.0;
		}

		public string GetHSFamilyName(HSDefineInfo curHSType)
		{
			string result = "";
			string text = "";
			curHSType.GetHSFamilyName(ref result, ref text, this.m_uiApp);
			return result;
		}

		public bool CreateHSFamily(HSDefineInfo curHSType, bool bDeleteExist = false, bool bLoadFamily = true, bool isTran = true)
		{
			string text = "";
			string text2 = "";
			Family family = null;
			curHSType.GetHSFamilyName(ref text, ref text2, this.m_uiApp);
			bool flag = HSFamily.IsFamilyIsLoaded(ref family, text, this.m_doc);
			bool result;
			if (flag)
			{
				result = true;
			}
			else
			{
				string text3 = this.m_strHSFamilyDir;
				text3 += text;
				text3 += HSFamily.m_strSuffixFamilyFile;
				bool flag2 = File.Exists(text3);
				if (flag2)
				{
					if (!bDeleteExist)
					{
						if (bLoadFamily)
						{
							bool flag3 = !this.LoadFamily(ref family, text, isTran);
							if (flag3)
							{
								Utils.MessageBox(text3);
								return false;
							}
						}
						return true;
					}
					File.Delete(text3);
				}
                Autodesk.Revit.DB.Document document = null;
				try
				{
					document = this.m_uiApp.Application.NewFamilyDocument(this.m_strFamilyTemplatePath);
				}
				catch (Exception ex)
				{
					Utils.MessageBox(this.m_strFamilyTemplatePath + "\n" + text3);
					return false;
				}
				bool flag4 = document == null;
				if (flag4)
				{
					Utils.MessageBox(this.m_strFamilyTemplatePath + "\n" + text3);
					result = false;
				}
				else
				{
					Level level = this.FindElement(typeof(Level), HSFamily.m_strLevelUpRefName, ref document) as Level;
					this.m_dElevationLevelUp = HSFamily.feetToMM(level.Elevation);
					Transaction transaction = new Transaction(document);
					transaction.Start("familyCreation");
					try
					{
						FamilyManager familyManager = document.FamilyManager;
						familyManager.CurrentType = familyManager.NewType(text2);
					}
					catch (Exception ex2)
					{
						Utils.MessageBox(ex2.Message);
						transaction.Commit();
						return false;
					}
					RevitVersionFuncs.SetFamilyMechanical(document);
					this.CreateHSFamilyElements(curHSType, ref document);
					this.AddParameterHSTypeName(text2, ref document);
					this.AddParametersByGroup("HY_HS_INDEX", (int)curHSType.m_eType, ref document, (Autodesk.Revit.DB.BuiltInParameterGroup)(-5000173), false);
					this.AddParametersByGroup("HY_HS_FLOORNUM", curHSType.m_nFloorNum, ref document, (Autodesk.Revit.DB.BuiltInParameterGroup)(-5000173), false);
					transaction.Commit();
					document.SaveAs(text3);
					document.Close(false);
					if (bLoadFamily)
					{
						bool flag5 = !this.LoadFamily(ref family, text, isTran);
						if (flag5)
						{
							return false;
						}
					}
					result = true;
				}
			}
			return result;
		}

		public bool CreateHSFamilyLabel(double dXMin, double dXMax, ref Autodesk.Revit.DB.Document familyDoc)
		{
			string text = "E:\\HSLabelTemplate.rfa";
			string strLabelTemplatePath = this.m_strLabelTemplatePath;
			bool flag = File.Exists(strLabelTemplatePath);
			if (flag)
			{
				text = strLabelTemplatePath;
			}
			string strFamilyName = "HSLabelTemplate";
			Family familyIn = null;
			bool flag2 = !this.LoadFamily(ref familyIn, strFamilyName, text, familyDoc);
			bool result;
			if (flag2)
			{
				Utils.MessageBox(text);
				result = false;
			}
			else
			{
				FamilySymbol familySymbolDefault = HSFamily.GetFamilySymbolDefault(familyIn);
				this.AddParametersByGroup("编号", "-1", ref familyDoc, (Autodesk.Revit.DB.BuiltInParameterGroup)(-5000123), true);
				this.AddParametersByGroup("前缀", "HS-", ref familyDoc, (Autodesk.Revit.DB.BuiltInParameterGroup)(-5000123), true);
				this.AddParametersByGroup("编号类型", "001", ref familyDoc, (Autodesk.Revit.DB.BuiltInParameterGroup)(-5000123), true);
				FamilyParameter familyParameter = this.AddParametersByGroup("整体编号", "HS-000", ref familyDoc, (Autodesk.Revit.DB.BuiltInParameterGroup)(-5000123), true);
				FamilyParameter familyParameter2 = this.AddParametersByGroup("显示位置", 0, ref familyDoc, (Autodesk.Revit.DB.BuiltInParameterGroup)(-5000123), true);
				familyDoc.FamilyManager.AssociateElementParameterToFamilyParameter(familySymbolDefault.GetParameter("Label"), familyParameter);
				familyDoc.FamilyManager.AssociateElementParameterToFamilyParameter(familySymbolDefault.GetParameter("PosType"), familyParameter2);
				double num = HSFamily.mmToFeet(120.0) / 2.0;
				double num2 = HSFamily.mmToFeet(dXMin);
				double num3 = HSFamily.mmToFeet(dXMax);
				double num4 = (num2 + num3) / 2.0;
				XYZ xyz = new XYZ(num2, -num, 0.0);
				XYZ xyz2 = new XYZ(num3, -num, 0.0);
				XYZ xyz3 = new XYZ(num4, num, 0.0);
				XYZ xyz4 = new XYZ(num4, -num, 0.0);
				XYZ xyz5 = new XYZ(num4, 0.0, 0.0);
				FamilyItemFactory familyCreate = familyDoc.FamilyCreate;
				Autodesk.Revit.DB.View view = this.FindElement(typeof(ViewPlan), HSFamily.m_strLevelRefName, ref familyDoc) as Autodesk.Revit.DB.View;
				AnnotationSymbol elem = familyCreate.NewFamilyInstance(xyz, familySymbolDefault, view) as AnnotationSymbol;
				AnnotationSymbol elem2 = familyCreate.NewFamilyInstance(xyz2, familySymbolDefault, view) as AnnotationSymbol;
				AnnotationSymbol elem3 = familyCreate.NewFamilyInstance(xyz3, familySymbolDefault, view) as AnnotationSymbol;
				AnnotationSymbol elem4 = familyCreate.NewFamilyInstance(xyz4, familySymbolDefault, view) as AnnotationSymbol;
				AnnotationSymbol elem5 = familyCreate.NewFamilyInstance(xyz5, familySymbolDefault, view) as AnnotationSymbol;
				FamilyParameter familyParameter3 = this.AddParametersByGroup("VisibleLeft", true, ref familyDoc, (Autodesk.Revit.DB.BuiltInParameterGroup)(-5000123), true);
				familyDoc.FamilyManager.SetFormula(familyParameter3, "显示位置=1");
				FamilyParameter familyParameter4 = this.AddParametersByGroup("VisibleRight", true, ref familyDoc, (Autodesk.Revit.DB.BuiltInParameterGroup)(-5000123), true);
				familyDoc.FamilyManager.SetFormula(familyParameter4, "显示位置=2");
				FamilyParameter familyParameter5 = this.AddParametersByGroup("VisibleUp", true, ref familyDoc, (Autodesk.Revit.DB.BuiltInParameterGroup)(-5000123), true);
				familyDoc.FamilyManager.SetFormula(familyParameter5, "显示位置=3");
				FamilyParameter familyParameter6 = this.AddParametersByGroup("VisibleDown", true, ref familyDoc, (Autodesk.Revit.DB.BuiltInParameterGroup)(-5000123), true);
				familyDoc.FamilyManager.SetFormula(familyParameter6, "显示位置=4");
				FamilyParameter familyParameter7 = this.AddParametersByGroup("VisibleMid", true, ref familyDoc, (Autodesk.Revit.DB.BuiltInParameterGroup)(-5000123), true);
				familyDoc.FamilyManager.SetFormula(familyParameter7, "显示位置=5");
				familyDoc.FamilyManager.AssociateElementParameterToFamilyParameter(elem.GetParameter(Autodesk.Revit.DB.BuiltInParameter.IS_VISIBLE_PARAM), familyParameter3);
				familyDoc.FamilyManager.AssociateElementParameterToFamilyParameter(elem2.GetParameter(Autodesk.Revit.DB.BuiltInParameter.IS_VISIBLE_PARAM), familyParameter4);
				familyDoc.FamilyManager.AssociateElementParameterToFamilyParameter(elem3.GetParameter(Autodesk.Revit.DB.BuiltInParameter.IS_VISIBLE_PARAM), familyParameter5);
				familyDoc.FamilyManager.AssociateElementParameterToFamilyParameter(elem4.GetParameter(Autodesk.Revit.DB.BuiltInParameter.IS_VISIBLE_PARAM), familyParameter6);
				familyDoc.FamilyManager.AssociateElementParameterToFamilyParameter(elem5.GetParameter(Autodesk.Revit.DB.BuiltInParameter.IS_VISIBLE_PARAM), familyParameter7);
				result = true;
			}
			return result;
		}

		public string GetSectionFamilyName(string strType)
		{
			string text = "HY_HS_SEC_";
			string str = text;
			str += strType;
			string versionNumber = this.m_uiApp.Application.VersionNumber;
			return str + "_" + versionNumber;
		}

		public bool CreateSectionFamily(string strType, bool bDeleteExist = true)
		{
			string sectionFamilyName = this.GetSectionFamilyName(strType);
			char c = strType[0];
			string str;
			switch (c)
			{
			case 'A':
				str = "圆钢";
				break;
			case 'B':
				str = "角钢";
				break;
			case 'C':
				str = "槽钢";
				break;
			case 'D':
				str = "工字钢";
				break;
			case 'E':
				str = "扁钢";
				break;
			case 'F':
				str = "方钢";
				break;
			case 'G':
				str = "H钢";
				break;
			case 'H':
				str = "C钢";
				break;
			case 'I':
				str = "环钢";
				break;
			default:
				if (c != 'Y')
				{
					if (c != 'Z')
					{
						return false;
					}
					str = "方形";
				}
				else
				{
					str = "圆形";
				}
				break;
			}
			string text = this.m_strHSFamilyDir;
			text += sectionFamilyName;
			text += HSFamily.m_strSuffixFamilyFile;
			bool flag = File.Exists(text);
			if (flag)
			{
				if (!bDeleteExist)
				{
					return true;
				}
				File.Delete(text);
			}
            Autodesk.Revit.DB.Document document = this.m_uiApp.Application.NewFamilyDocument(this.m_strSectionTemplatePath);
			bool flag2 = document == null;
			bool result;
			if (flag2)
			{
				Utils.MessageBox(this.m_strSectionTemplatePath);
				result = false;
			}
			else
			{
				Transaction transaction = new Transaction(document);
				transaction.Start("familyCreation");
				try
				{
					FamilyManager familyManager = document.FamilyManager;
					familyManager.CurrentType = familyManager.NewType(str + "水平");
					familyManager.NewType(str + "竖直");
					familyManager.NewType(str + "倾斜");
				}
				catch (Exception ex)
				{
					Utils.MessageBox(ex.Message);
					transaction.Commit();
					return false;
				}
				this.CreateSectionFamilyElements(strType, ref document);
				transaction.Commit();
				document.SaveAs(text);
				document.Close(false);
				result = true;
			}
			return result;
		}

		private bool CreateHSFamilyElements(HSDefineInfo curHSType, ref Autodesk.Revit.DB.Document familyDoc)
		{
			HSType eType = curHSType.m_eType;
			switch (eType)
			{
			case HSType.kZJ_DC:
				this.CreateHSFamilyElementsZJ_DC(curHSType, ref familyDoc, false);
				break;
			case HSType.kZJ_PX:
				this.CreateHSFamilyElementsZJ_PX(curHSType, ref familyDoc);
				break;
			case HSType.kZJ_SJ:
				this.CreateHSFamilyElementsZJ_SJ(curHSType, ref familyDoc);
				break;
			case HSType.kZJ_XB:
				this.CreateHSFamilyElementsZJ_XB(curHSType, ref familyDoc);
				break;
			case HSType.kZJ_CB:
				this.CreateHSFamilyElementsZJ_CB(curHSType, ref familyDoc);
				break;
			case HSType.kZJ_DZ:
				this.CreateHSFamilyElementsZJ_DZ(curHSType, ref familyDoc);
				break;
			case HSType.kZJ_TQ:
				this.CreateHSFamilyElementsZJ_TQ(curHSType, ref familyDoc);
				break;
			case HSType.kZJ_DQ:
				this.CreateHSFamilyElementsZJ_DQ(curHSType, ref familyDoc);
				break;
			default:
				switch (eType)
				{
				case HSType.kDJ_DC:
					this.CreateHSFamilyElementsDJ_DC(curHSType, ref familyDoc, false);
					break;
				case HSType.kDJ_PX:
					this.CreateHSFamilyElementsDJ_PX(curHSType, ref familyDoc);
					break;
				case HSType.kDJ_GJ:
					this.CreateHSFamilyElementsDJ_GJ(curHSType, ref familyDoc);
					break;
				case HSType.kDJ_DB:
					this.CreateHSFamilyElementsDJ_DB(curHSType, ref familyDoc);
					break;
				case HSType.kDJ_DG:
					this.CreateHSFamilyElementsDJ_DG(curHSType, ref familyDoc);
					break;
				case HSType.kDJ_SG:
					this.CreateHSFamilyElementsDJ_SG(curHSType, ref familyDoc);
					break;
				case HSType.kDJ_SL:
					this.CreateHSFamilyElementsDJ_SL(curHSType, ref familyDoc);
					break;
				case HSType.kDJ_ZJ:
					this.CreateHSFamilyElementsDJ_ZJ(curHSType, ref familyDoc);
					break;
				case HSType.kDJ_YC:
					this.CreateHSFamilyElementsDJ_YC(curHSType, ref familyDoc);
					break;
				case HSType.kDJ_DC3:
					this.CreateHSFamilyElementsDJ_DC3(curHSType, ref familyDoc, false);
					break;
				case HSType.kDJ_PX3:
					this.CreateHSFamilyElementsDJ_PX3(curHSType, ref familyDoc);
					break;
				case HSType.kDJ_DZ:
					this.CreateHSFamilyElementsDJ_DZ(curHSType, ref familyDoc);
					break;
				}
				break;
			}
			return true;
		}

		private void AddParameterHSTypeName(string strTypeName, ref Autodesk.Revit.DB.Document familyDoc)
		{
			this.AddParametersByGroup("HY_HS_TYPE", strTypeName, ref familyDoc, (Autodesk.Revit.DB.BuiltInParameterGroup)(-5000173), false);
		}

		private bool CreateHSFamilyElementsZJ_PX(HSDefineInfo curHSType, ref Autodesk.Revit.DB.Document familyDoc)
		{
			return this.CreateHSFamilyElementsZJ_DC(curHSType, ref familyDoc, true);
		}

		private bool CreateHSFamilyElementsZJ_DC(HSDefineInfo curHSType, ref Autodesk.Revit.DB.Document familyDoc, bool bHasPX = false)
		{
			int nFloorNum = curHSType.m_nFloorNum;
			string strCode = curHSType.m_matVer.m_strCode;
			string strCode2 = curHSType.m_matHor.m_strCode;
			double num = 1000.0;
			double num2 = 500.0;
			bool flag = nFloorNum > 5;
			if (flag)
			{
				num2 = 100.0;
			}
			double num3 = this.dHorH;
			double num4 = this.dHorH;
			double num5 = 1000.0;
			double num6 = num4 + (num2 + num4) * (double)(nFloorNum - 1) + num5;
			double num7 = 600.0;
			FamilySymbol familySymbol = this.CreateSectionSymbol(curHSType.m_matVer.m_strCode, ref familyDoc, 1);
			FamilySymbol familySymbol2 = this.CreateSectionSymbol(curHSType.m_matHor.m_strCode, ref familyDoc, 0);
			bool flag2 = familySymbol == null || familySymbol2 == null;
			bool result;
			if (flag2)
			{
				result = false;
			}
			else
			{
				FamilySymbolProfile familySymbolProfile = this.m_revit.Create.NewFamilySymbolProfile(familySymbol);
				FamilySymbolProfile familySymbolProfile2 = this.m_revit.Create.NewFamilySymbolProfile(familySymbol2);
				this.AddReferencePlaneX(num / 2.0, "Right", ref familyDoc);
				this.AddReferencePlaneX(-num / 2.0, "Left", ref familyDoc);
				this.AddReferencePlaneX(num / 2.0 + num3 / 2.0, "RightCenter", ref familyDoc);
				this.AddReferencePlaneX(-num / 2.0 - num3 / 2.0, "LeftCenter", ref familyDoc);
				this.AddReferencePlaneX(num / 2.0 + num3, "RightRight", ref familyDoc);
				this.AddReferencePlaneX(-num / 2.0 - num3, "LeftLeft", ref familyDoc);
				for (int i = 0; i < nFloorNum; i++)
				{
					this.AddReferencePlaneZ(num6 - (num2 + num4) * (double)i, "Elevation" + i.ToString(), ref familyDoc);
					this.AddReferencePlaneZ(num6 - (num2 + num4) * (double)i - num4 / 2.0, "ElevationOffset" + i.ToString(), ref familyDoc);
					this.AddReferencePlaneZ(num6 - (num2 + num4) * (double)i - num4, "ElevationBottom" + i.ToString(), ref familyDoc);
				}
				bool bExtendToTop = curHSType.m_bExtendToTop;
				if (bExtendToTop)
				{
					curHSType.m_dTunnelCompartmentHeight += num6;
					this.AddReferencePlaneZ(curHSType.m_dTunnelCompartmentHeight, "CompartmentTop", ref familyDoc);
					this.AddParameters(HSFamily.m_strTunnelHeight, curHSType.m_dTunnelCompartmentHeight, ref familyDoc, true);
				}
				for (int j = 1; j < nFloorNum; j++)
				{
					this.AddParameters("净高" + j.ToString(), num2, ref familyDoc, true);
				}
				this.AddParameters("净宽", num, ref familyDoc, true);
				this.AddParameters(HSFamily.m_strOffsetHigh, num5, ref familyDoc, true);
				FamilyParameter familyParameter = this.AddParametersNoMainSize("OffsetBaseHigh", this.dHorH + num5, ref familyDoc, true);
				familyDoc.FamilyManager.SetFormula(familyParameter, "横担高h+" + HSFamily.m_strOffsetHigh);
				this.AddDimensionPlan("Left", "LeftLeft", "竖杆高h", ref familyDoc);
				this.AddDimensionPlanAverage("Left", "LeftLeft", "LeftCenter", ref familyDoc);
				this.AddDimensionPlan("Right", "RightRight", "竖杆高h", ref familyDoc);
				this.AddDimensionPlanAverage("Right", "RightRight", "RightCenter", ref familyDoc);
				for (int k = 0; k < nFloorNum; k++)
				{
					this.AddDimensionForeAverage("Elevation" + k.ToString(), "ElevationBottom" + k.ToString(), "ElevationOffset" + k.ToString(), ref familyDoc);
					this.AddDimensionFore("Elevation" + k.ToString(), "ElevationBottom" + k.ToString(), "横担高h", ref familyDoc);
				}
				double num8 = num6 - num4;
				for (int l = 1; l < nFloorNum; l++)
				{
					string strRefPlanName = "ElevationBottom" + (l - 1).ToString();
					string strRefPlanName2 = "Elevation" + l.ToString();
					string strParameterName = "净高" + l.ToString();
					this.AddDimensionFore(strRefPlanName2, strRefPlanName, strParameterName, ref familyDoc);
				}
				this.AddDimensionPlanAverage("Left", "Right", HSFamily.m_strLeftRightCenRefName, ref familyDoc);
				this.AddDimensionPlan("Left", "Right", "净宽", ref familyDoc);
				this.AddDimensionLevel("Elevation" + (nFloorNum - 1).ToString(), "OffsetBaseHigh", ref familyDoc);
				bool bExtendToTop2 = curHSType.m_bExtendToTop;
				if (bExtendToTop2)
				{
					this.AddDimensionPlan(HSFamily.m_strLevelRefName, "CompartmentTop", "舱室净高", ref familyDoc);
				}
				ReferencePlane referencePlane = this.AddReferencePlaneY(-this.dHorB, "BHOffset", ref familyDoc);
				this.AddReferencePlaneY(-this.dHorB / 2.0, "BHOffsetTop", ref familyDoc);
				this.AddReferencePlaneY(-this.dHorB * 1.5, "BHOffsetBottom", ref familyDoc);
				FamilyParameter familyParameter2 = this.AddParametersNoMainSize("BHOffsetPar", this.dHorB, ref familyDoc, true);
				familyDoc.FamilyManager.SetFormula(familyParameter2, "横担宽b/2+竖杆宽b/2");
				this.AddDimensionPlan(HSFamily.m_strForeBackCenRefName, "BHOffset", "BHOffsetPar", ref familyDoc);
				this.AddDimensionPlan("BHOffsetTop", "BHOffsetBottom", "横担宽b", ref familyDoc);
				this.AddDimensionPlanAverage("BHOffsetTop", "BHOffsetBottom", "BHOffset", ref familyDoc);
				CurveArray curveArray = new CurveArray();
				XYZ zero = XYZ.Zero;
				Plane plane = RevitVersionFuncs.CreatePlanByNormalAndOrigin(new XYZ(0.0, -1.0, 0.0), zero);
				SketchPlane sketchPlane = SketchPlane.Create(familyDoc, plane);
				SketchPlane sketchPlane2 = null;
				double num9 = HSFamily.mmToFeet(num / 2.0);
				familySymbolProfile2.Angle = -Math.PI*.5;
				bool flag3 = curHSType.m_eLinkType != HSLinkType.kLinkBH;
				if (flag3)
				{
					for (int m = 0; m < nFloorNum; m++)
					{
						bool flag4 = m == 0 && curHSType.m_eLinkType == HSLinkType.kLinkDH;
						if (!flag4)
						{
							double num10 = HSFamily.mmToFeet(num6 - (double)m * (num2 + num4) - num4 / 2.0);
							curveArray.Clear();
							curveArray.Append(Line.CreateBound(new XYZ(-num9, 0.0, num10), new XYZ(num9, 0.0, num10)));
							familyDoc.FamilyCreate.NewSweep(true, curveArray, sketchPlane, familySymbolProfile2, 0, 0);
							this.CreateSolid(curveArray, sketchPlane, familySymbolProfile2, ref familyDoc, true);
						}
					}
				}
				else
				{
					double num11 = HSFamily.mmToFeet(this.dHorB);
					double num12 = HSFamily.mmToFeet(this.dHorB) * 2.0;
					sketchPlane2 = SketchPlane.Create(familyDoc, referencePlane.Id);
					for (int n = 0; n < nFloorNum; n++)
					{
						double num13 = HSFamily.mmToFeet(num6 - (double)n * (num2 + num4) - num4 / 2.0);
						curveArray.Clear();
						bool flag5 = n == 0 && bHasPX;
						if (flag5)
						{
							curveArray.Append(Line.CreateBound(new XYZ(-num9, 0.0, num13), new XYZ(num9, 0.0, num13)));
							this.CreateSolid(curveArray, sketchPlane, familySymbolProfile2, ref familyDoc, true);
						}
						else
						{
							curveArray.Append(Line.CreateBound(new XYZ(num9 + num12, -num11, num13), new XYZ(-num9 - num12, -num11, num13)));
							this.CreateSolid(curveArray, sketchPlane2, familySymbolProfile2, ref familyDoc, true);
						}
					}
				}
				double num14 = HSFamily.mmToFeet(num6);
				num9 = HSFamily.mmToFeet(num / 2.0 + num3 / 2.0);
				familySymbolProfile.Angle = -Math.PI*.5;
				bool flag6 = curHSType.m_eLinkType == HSLinkType.kLinkDH;
				if (flag6)
				{
					num14 = HSFamily.mmToFeet(num6 - num4 / 2.0);
				}
				curveArray.Clear();
				curveArray.Append(Line.CreateBound(new XYZ(-num9, 0.0, curHSType.m_bExtendToTop ? HSFamily.mmToFeet(curHSType.m_dTunnelCompartmentHeight) : num14), new XYZ(-num9, 0.0, 0.0)));
				bool flag7 = curHSType.m_eLinkType == HSLinkType.kLinkDH;
				if (flag7)
				{
					bool flag8 = !bHasPX;
					if (flag8)
					{
						curveArray.Append(Line.CreateBound(new XYZ(-num9, 0.0, num14), new XYZ(num9, 0.0, num14)));
					}
					else
					{
						curveArray.Append(Line.CreateBound(new XYZ(-num9, 0.0, num14), new XYZ(num9 - HSFamily.mmToFeet(num3 / 2.0), 0.0, num14)));
					}
				}
				else
				{
					this.CreateSolid(curveArray, sketchPlane, familySymbolProfile, ref familyDoc, true);
					curveArray.Clear();
				}
				bool flag9 = !bHasPX;
				if (flag9)
				{
					curveArray.Append(Line.CreateBound(new XYZ(num9, 0.0, 0.0), new XYZ(num9, 0.0, curHSType.m_bExtendToTop ? HSFamily.mmToFeet(curHSType.m_dTunnelCompartmentHeight) : num14)));
				}
				bool flag10 = curveArray.Size > 0;
				if (flag10)
				{
					this.CreateSolid(curveArray, sketchPlane, familySymbolProfile, ref familyDoc, true);
				}
				Autodesk.Revit.DB.View view = this.FindElement(typeof(ViewPlan), HSFamily.m_strLevelRefName, ref familyDoc) as Autodesk.Revit.DB.View;
				familyDoc.FamilyCreate.NewControl((Autodesk.Revit.DB.ControlShape)3, view, zero + XYZ.BasisX * HSFamily.mmToFeet(200.0));
				familyDoc.FamilyCreate.NewControl((Autodesk.Revit.DB.ControlShape)2, view, zero);
				this.CreateHSLinkDevice(new XYZ(-num9, 0.0, 0.0), 3, HSFamily.m_strLevelRefName, ref familyDoc, "连接件1", true, HSLinkDevice.kLinkDeviceRect, "Left", false);
				this.CreateHSLinkDevice(new XYZ(num9, 0.0, 0.0), 3, HSFamily.m_strLevelRefName, ref familyDoc, "连接件2", false, HSLinkDevice.kLinkDeviceRect, "Left", false);
				bool bExtendToTop3 = curHSType.m_bExtendToTop;
				if (bExtendToTop3)
				{
					this.CreateHSLinkDevice(new XYZ(num9, 0.0, HSFamily.mmToFeet(curHSType.m_dTunnelCompartmentHeight)), 2, HSFamily.m_strLevelRefName, ref familyDoc, "连接件3", true, HSLinkDevice.kLinkDeviceRect, "Left", true);
					this.CreateHSLinkDevice(new XYZ(-num9, 0.0, HSFamily.mmToFeet(curHSType.m_dTunnelCompartmentHeight)), 2, HSFamily.m_strLevelRefName, ref familyDoc, "连接件4", false, HSLinkDevice.kLinkDeviceRect, "Left", true);
				}
				this.CreateHSFamilyLabel(-num / 2.0, num / 2.0, ref familyDoc);
				if (bHasPX)
				{
					num14 = HSFamily.mmToFeet(num6);
					this.AddReferencePlaneZ(num6 + num2 + num4, "ElevationPXUp", ref familyDoc);
					this.AddReferencePlaneZ(num6 + num2 + num4 - num4 / 2.0, "ElevationPX", ref familyDoc);
					this.AddReferencePlaneZ(num6 + num2 + num4 - num4, "ElevationPXDown", ref familyDoc);
					this.AddReferencePlaneX(num / 2.0 - num7 - num3, "ElevationPXXLeft", ref familyDoc);
					this.AddReferencePlaneX(num / 2.0 - num7 - num3 / 2.0, "ElevationPXX", ref familyDoc);
					this.AddReferencePlaneX(num / 2.0 - num7, "ElevationPXXRight", ref familyDoc);
					this.AddParameters("偏心净高", num2, ref familyDoc, true);
					this.AddParameters("偏心净宽", num7, ref familyDoc, true);
					this.AddDimensionFore("ElevationPXXRight", "Right", "偏心净宽", ref familyDoc);
					this.AddDimensionFore("Elevation0", "ElevationPXDown", "偏心净高", ref familyDoc);
					this.AddDimensionForeAverage("ElevationPXUp", "ElevationPXDown", "ElevationPX", ref familyDoc);
					this.AddDimensionFore("ElevationPXUp", "ElevationPXDown", "横担高h", ref familyDoc);
					this.AddDimensionPlan("ElevationPXXLeft", "ElevationPXXRight", "竖杆高h", ref familyDoc);
					this.AddDimensionPlanAverage("ElevationPXXLeft", "ElevationPXXRight", "ElevationPXX", ref familyDoc);
					double num15 = HSFamily.mmToFeet(num / 2.0 - num7 - num3 / 2.0);
					curveArray.Clear();
					bool flag11 = curHSType.m_eLinkType == HSLinkType.kLinkDH;
					double num16;
					if (flag11)
					{
						num16 = HSFamily.mmToFeet(num6 + num2 + num4 / 2.0);
						curveArray.Append(Line.CreateBound(new XYZ(num9, 0.0, 0.0), new XYZ(num9, 0.0, num16)));
						curveArray.Append(Line.CreateBound(new XYZ(num9, 0.0, num16), new XYZ(num15, 0.0, num16)));
						curveArray.Append(Line.CreateBound(new XYZ(num15, 0.0, num16), new XYZ(num15, 0.0, num14)));
					}
					else
					{
						num16 = HSFamily.mmToFeet(num6 + num2 + num4);
						curveArray.Append(Line.CreateBound(new XYZ(num9, 0.0, 0.0), new XYZ(num9, 0.0, num16)));
						this.CreateSolid(curveArray, sketchPlane, familySymbolProfile, ref familyDoc, true);
						curveArray.Clear();
						curveArray.Append(Line.CreateBound(new XYZ(num15, 0.0, num16), new XYZ(num15, 0.0, num14)));
					}
					this.CreateSolid(curveArray, sketchPlane, familySymbolProfile, ref familyDoc, true);
					num16 = HSFamily.mmToFeet(num6 + num2 + 0.5 * num4);
					bool flag12 = curHSType.m_eLinkType == HSLinkType.kLinkCG;
					if (flag12)
					{
						curveArray.Clear();
						double num17 = HSFamily.mmToFeet(num3 / 2.0);
						curveArray.Append(Line.CreateBound(new XYZ(num15 + num17, 0.0, num16), new XYZ(num9 - num17, 0.0, num16)));
						this.CreateSolid(curveArray, sketchPlane, familySymbolProfile2, ref familyDoc, true);
					}
					else
					{
						bool flag13 = curHSType.m_eLinkType == HSLinkType.kLinkBH;
						if (flag13)
						{
							curveArray.Clear();
							double num18 = HSFamily.mmToFeet(num3 / 2.0);
							double num19 = HSFamily.mmToFeet(this.dHorB);
							curveArray.Append(Line.CreateBound(new XYZ(num9 + num18, -num19, num16), new XYZ(num15 - num18, -num19, num16)));
							this.CreateSolid(curveArray, sketchPlane2, familySymbolProfile2, ref familyDoc, true);
						}
					}
				}
				result = true;
			}
			return result;
		}

		private bool CreateHSFamilyElementsZJ_DZ(HSDefineInfo curHSType, ref Autodesk.Revit.DB.Document familyDoc)
		{
			int nFloorNum = curHSType.m_nFloorNum;
			string strCode = curHSType.m_matVer.m_strCode;
			string strCode2 = curHSType.m_matHor.m_strCode;
			double num = 1000.0;
			double num2 = 500.0;
			bool flag = nFloorNum > 5;
			if (flag)
			{
				num2 = 100.0;
			}
			double num3 = this.dHorH;
			double num4 = this.dHorH;
			double num5 = 1000.0;
			double num6 = num4 + (num2 + num4) * (double)(nFloorNum - 1) + num5;
			FamilySymbol familySymbol = this.CreateSectionSymbol(curHSType.m_matVer.m_strCode, ref familyDoc, 1);
			FamilySymbol familySymbol2 = this.CreateSectionSymbol(curHSType.m_matHor.m_strCode, ref familyDoc, 0);
			bool flag2 = familySymbol == null || familySymbol2 == null;
			bool result;
			if (flag2)
			{
				result = false;
			}
			else
			{
				FamilySymbolProfile familySymbolProfile = this.m_revit.Create.NewFamilySymbolProfile(familySymbol);
				FamilySymbolProfile familySymbolProfile2 = this.m_revit.Create.NewFamilySymbolProfile(familySymbol2);
				this.AddReferencePlaneX(num / 2.0, "Right", ref familyDoc);
				this.AddReferencePlaneX(-num / 2.0, "Left", ref familyDoc);
				this.AddReferencePlaneX(num / 2.0 + num3 / 2.0, "RightCenter", ref familyDoc);
				this.AddReferencePlaneX(-num / 2.0 - num3 / 2.0, "LeftCenter", ref familyDoc);
				this.AddReferencePlaneX(num / 2.0 + num3, "RightRight", ref familyDoc);
				this.AddReferencePlaneX(-num / 2.0 - num3, "LeftLeft", ref familyDoc);
				for (int i = 0; i < nFloorNum; i++)
				{
					this.AddReferencePlaneZ(num6 - (num2 + num4) * (double)i, "Elevation" + i.ToString(), ref familyDoc);
					this.AddReferencePlaneZ(num6 - (num2 + num4) * (double)i - num4 / 2.0, "ElevationOffset" + i.ToString(), ref familyDoc);
					this.AddReferencePlaneZ(num6 - (num2 + num4) * (double)i - num4, "ElevationBottom" + i.ToString(), ref familyDoc);
				}
				bool bExtendToTop = curHSType.m_bExtendToTop;
				if (bExtendToTop)
				{
					curHSType.m_dTunnelCompartmentHeight += num6;
					this.AddReferencePlaneZ(curHSType.m_dTunnelCompartmentHeight, "CompartmentTop", ref familyDoc);
					this.AddParameters(HSFamily.m_strTunnelHeight, curHSType.m_dTunnelCompartmentHeight, ref familyDoc, true);
				}
				for (int j = 1; j < nFloorNum; j++)
				{
					this.AddParameters("净高" + j.ToString(), num2, ref familyDoc, true);
				}
				this.AddParameters("净宽", num, ref familyDoc, true);
				this.AddParameters(HSFamily.m_strOffsetHigh, num5, ref familyDoc, true);
				FamilyParameter familyParameter = this.AddParametersNoMainSize("OffsetBaseHigh", this.dHorH + num5, ref familyDoc, true);
				familyDoc.FamilyManager.SetFormula(familyParameter, "横担高h+" + HSFamily.m_strOffsetHigh);
				this.AddDimensionPlan("Left", "LeftLeft", "竖杆高h", ref familyDoc);
				this.AddDimensionPlanAverage("Left", "LeftLeft", "LeftCenter", ref familyDoc);
				this.AddDimensionPlan("Right", "RightRight", "竖杆高h", ref familyDoc);
				this.AddDimensionPlanAverage("Right", "RightRight", "RightCenter", ref familyDoc);
				for (int k = 0; k < nFloorNum; k++)
				{
					this.AddDimensionForeAverage("Elevation" + k.ToString(), "ElevationBottom" + k.ToString(), "ElevationOffset" + k.ToString(), ref familyDoc);
					this.AddDimensionFore("Elevation" + k.ToString(), "ElevationBottom" + k.ToString(), "横担高h", ref familyDoc);
				}
				double num7 = num6 - num4;
				for (int l = 1; l < nFloorNum; l++)
				{
					string strRefPlanName = "ElevationBottom" + (l - 1).ToString();
					string strRefPlanName2 = "Elevation" + l.ToString();
					string strParameterName = "净高" + l.ToString();
					this.AddDimensionFore(strRefPlanName2, strRefPlanName, strParameterName, ref familyDoc);
				}
				this.AddDimensionPlanAverage("Left", "Right", HSFamily.m_strLeftRightCenRefName, ref familyDoc);
				this.AddDimensionPlan("Left", "Right", "净宽", ref familyDoc);
				this.AddDimensionLevel("Elevation" + (nFloorNum - 1).ToString(), "OffsetBaseHigh", ref familyDoc);
				bool bExtendToTop2 = curHSType.m_bExtendToTop;
				if (bExtendToTop2)
				{
					this.AddDimensionPlan(HSFamily.m_strLevelRefName, "CompartmentTop", "舱室净高", ref familyDoc);
				}
				ReferencePlane referencePlane = this.AddReferencePlaneY(-this.dHorB, "BHOffset", ref familyDoc);
				this.AddReferencePlaneY(-this.dHorB / 2.0, "BHOffsetTop", ref familyDoc);
				this.AddReferencePlaneY(-this.dHorB * 1.5, "BHOffsetBottom", ref familyDoc);
				FamilyParameter familyParameter2 = this.AddParametersNoMainSize("BHOffsetPar", this.dHorB, ref familyDoc, true);
				familyDoc.FamilyManager.SetFormula(familyParameter2, "横担宽b/2+竖杆宽b/2");
				this.AddDimensionPlan(HSFamily.m_strForeBackCenRefName, "BHOffset", "BHOffsetPar", ref familyDoc);
				this.AddDimensionPlan("BHOffsetTop", "BHOffsetBottom", "横担宽b", ref familyDoc);
				this.AddDimensionPlanAverage("BHOffsetTop", "BHOffsetBottom", "BHOffset", ref familyDoc);
				CurveArray curveArray = new CurveArray();
				XYZ zero = XYZ.Zero;
				Plane plane = RevitVersionFuncs.CreatePlanByNormalAndOrigin(new XYZ(0.0, -1.0, 0.0), zero);
				SketchPlane sketchPlane = SketchPlane.Create(familyDoc, plane);
				double num8 = HSFamily.mmToFeet(num / 2.0);
				familySymbolProfile2.Angle = -Math.PI*.5;
				double num9 = 0.0;
				bool flag3 = curHSType.m_eLinkType != HSLinkType.kLinkBH;
				if (flag3)
				{
					for (int m = 0; m < nFloorNum; m++)
					{
						bool flag4 = m == 0 && curHSType.m_eLinkType == HSLinkType.kLinkDH;
						if (!flag4)
						{
							double num10 = HSFamily.mmToFeet(num6 - (double)m * (num2 + num4) - num4 / 2.0);
							curveArray.Clear();
							curveArray.Append(Line.CreateBound(new XYZ(-num8, 0.0, num10), new XYZ(num8, 0.0, num10)));
							familyDoc.FamilyCreate.NewSweep(true, curveArray, sketchPlane, familySymbolProfile2, 0, 0);
							this.CreateSolid(curveArray, sketchPlane, familySymbolProfile2, ref familyDoc, true);
						}
					}
				}
				else
				{
					num9 = HSFamily.mmToFeet(this.dHorB);
					double num11 = HSFamily.mmToFeet(this.dHorB);
					SketchPlane sketchPlane2 = SketchPlane.Create(familyDoc, referencePlane.Id);
					for (int n = 0; n < nFloorNum; n++)
					{
						double num12 = HSFamily.mmToFeet(num6 - (double)n * (num2 + num4) - num4 / 2.0);
						curveArray.Clear();
						curveArray.Append(Line.CreateBound(new XYZ(num8 + num11 * 2.0, -num9, num12), new XYZ(-num8, -num9, num12)));
						this.CreateSolid(curveArray, sketchPlane2, familySymbolProfile2, ref familyDoc, true);
					}
				}
				double num13 = HSFamily.mmToFeet(num6);
				num8 = HSFamily.mmToFeet(num / 2.0 + num3 / 2.0);
				familySymbolProfile.Angle = -Math.PI*.5;
				bool flag5 = curHSType.m_eLinkType == HSLinkType.kLinkDH;
				if (flag5)
				{
					num13 = HSFamily.mmToFeet(num6 - num4 / 2.0);
				}
				curveArray.Clear();
				bool flag6 = curHSType.m_eLinkType == HSLinkType.kLinkDH;
				if (flag6)
				{
					curveArray.Append(Line.CreateBound(new XYZ(-num8 + num9 * 2.0, 0.0, num13), new XYZ(num8, 0.0, num13)));
				}
				curveArray.Append(Line.CreateBound(new XYZ(num8, 0.0, 0.0), new XYZ(num8, 0.0, curHSType.m_bExtendToTop ? HSFamily.mmToFeet(curHSType.m_dTunnelCompartmentHeight) : num13)));
				this.CreateSolid(curveArray, sketchPlane, familySymbolProfile, ref familyDoc, true);
				Autodesk.Revit.DB.View view = this.FindElement(typeof(ViewPlan), HSFamily.m_strLevelRefName, ref familyDoc) as Autodesk.Revit.DB.View;
				familyDoc.FamilyCreate.NewControl((Autodesk.Revit.DB.ControlShape)3, view, zero + XYZ.BasisX * HSFamily.mmToFeet(200.0));
				familyDoc.FamilyCreate.NewControl((Autodesk.Revit.DB.ControlShape)2, view, zero);
				this.CreateHSLinkDevice(new XYZ(num8, 0.0, 0.0), 3, HSFamily.m_strLevelRefName, ref familyDoc, "连接件1", true, HSLinkDevice.kLinkDeviceRect, "Left", false);
				bool bExtendToTop3 = curHSType.m_bExtendToTop;
				if (bExtendToTop3)
				{
					this.CreateHSLinkDevice(new XYZ(num8, 0.0, HSFamily.mmToFeet(curHSType.m_dTunnelCompartmentHeight)), 2, HSFamily.m_strLevelRefName, ref familyDoc, "连接件", true, HSLinkDevice.kLinkDeviceRect, "Left", true);
				}
				num8 = HSFamily.mmToFeet(num / 2.0);
				string strRefPlanName3 = "BHOffset";
				bool flag7 = curHSType.m_eLinkType != HSLinkType.kLinkBH;
				if (flag7)
				{
					strRefPlanName3 = HSFamily.m_strForeBackCenRefName;
				}
				for (int num14 = 0; num14 < nFloorNum; num14++)
				{
					double num15 = HSFamily.mmToFeet(num6 - (double)num14 * (num2 + num4) - num4 / 2.0);
					this.CreateHSLinkDevice(new XYZ(-num8, -num9, num15), 0, strRefPlanName3, ref familyDoc, "连接件" + (num14 + 2).ToString(), num14 == 0, HSLinkDevice.kLinkDeviceRect, "Left", false);
				}
				this.CreateHSFamilyLabel(-num / 2.0, num / 2.0, ref familyDoc);
				result = true;
			}
			return result;
		}

		private bool CreateHSFamilyElementsZJ_TQ(HSDefineInfo curHSType, ref Autodesk.Revit.DB.Document familyDoc)
		{
			int nFloorNum = curHSType.m_nFloorNum;
			string strCode = curHSType.m_matVer.m_strCode;
			string strCode2 = curHSType.m_matHor.m_strCode;
			double num = 1000.0;
			double num2 = 500.0;
			bool flag = nFloorNum > 5;
			if (flag)
			{
				num2 = 100.0;
			}
			double num3 = this.dHorH;
			double num4 = this.dHorH;
			double num5 = 1000.0;
			double num6 = num4 + (num2 + num4) * (double)(nFloorNum - 1) + num5;
			FamilySymbol familySymbol = this.CreateSectionSymbol(curHSType.m_matVer.m_strCode, ref familyDoc, 1);
			FamilySymbol familySymbol2 = this.CreateSectionSymbol(curHSType.m_matHor.m_strCode, ref familyDoc, 0);
			bool flag2 = familySymbol == null || familySymbol2 == null;
			bool result;
			if (flag2)
			{
				result = false;
			}
			else
			{
				FamilySymbolProfile familySymbolProfile = this.m_revit.Create.NewFamilySymbolProfile(familySymbol);
				FamilySymbolProfile familySymbolProfile2 = this.m_revit.Create.NewFamilySymbolProfile(familySymbol2);
				this.AddReferencePlaneX(num / 2.0, "Right", ref familyDoc);
				this.AddReferencePlaneX(-num / 2.0 + num3, "Left", ref familyDoc);
				this.AddReferencePlaneX(num / 2.0 + num3 / 2.0, "RightCenter", ref familyDoc);
				this.AddReferencePlaneX(-num / 2.0 + num3 / 2.0, "LeftCenter", ref familyDoc);
				this.AddReferencePlaneX(num / 2.0 + num3, "RightRight", ref familyDoc);
				this.AddReferencePlaneX(-num / 2.0, "LeftLeft", ref familyDoc);
				for (int i = 0; i < nFloorNum; i++)
				{
					this.AddReferencePlaneZ(num6 - (num2 + num4) * (double)i, "Elevation" + i.ToString(), ref familyDoc);
					this.AddReferencePlaneZ(num6 - (num2 + num4) * (double)i - num4 / 2.0, "ElevationOffset" + i.ToString(), ref familyDoc);
					this.AddReferencePlaneZ(num6 - (num2 + num4) * (double)i - num4, "ElevationBottom" + i.ToString(), ref familyDoc);
				}
				this.AddReferencePlaneZ(num6 + 100.0, "VertColumnTop", ref familyDoc);
				this.AddReferencePlaneZ(num6 - (num2 + num4) * (double)(nFloorNum - 1) - num4 - 100.0, "VertColumnBottom", ref familyDoc);
				this.AddParameters("顶部延伸", 100.0, ref familyDoc, true);
				this.AddParameters("底部延伸", 100.0, ref familyDoc, true);
				for (int j = 1; j < nFloorNum; j++)
				{
					this.AddParameters("净高" + j.ToString(), num2, ref familyDoc, true);
				}
				this.AddParameters("净宽", num, ref familyDoc, true);
				this.AddParameters(HSFamily.m_strOffsetHigh, num5, ref familyDoc, true);
				FamilyParameter familyParameter = this.AddParametersNoMainSize("OffsetBaseHigh", this.dHorH + num5, ref familyDoc, true);
				familyDoc.FamilyManager.SetFormula(familyParameter, "横担高h+" + HSFamily.m_strOffsetHigh);
				this.AddDimensionPlan("Left", "LeftLeft", "竖杆高h", ref familyDoc);
				this.AddDimensionPlanAverage("Left", "LeftLeft", "LeftCenter", ref familyDoc);
				this.AddDimensionPlan("Right", "RightRight", "竖杆高h", ref familyDoc);
				this.AddDimensionPlanAverage("Right", "RightRight", "RightCenter", ref familyDoc);
				this.AddDimensionFore("VertColumnTop", "Elevation0", "顶部延伸", ref familyDoc);
				this.AddDimensionFore("ElevationBottom" + (nFloorNum - 1).ToString(), "VertColumnBottom", "底部延伸", ref familyDoc);
				for (int k = 0; k < nFloorNum; k++)
				{
					this.AddDimensionForeAverage("Elevation" + k.ToString(), "ElevationBottom" + k.ToString(), "ElevationOffset" + k.ToString(), ref familyDoc);
					this.AddDimensionFore("Elevation" + k.ToString(), "ElevationBottom" + k.ToString(), "横担高h", ref familyDoc);
				}
				double num7 = num6 - num4;
				for (int l = 1; l < nFloorNum; l++)
				{
					string strRefPlanName = "ElevationBottom" + (l - 1).ToString();
					string strRefPlanName2 = "Elevation" + l.ToString();
					string strParameterName = "净高" + l.ToString();
					this.AddDimensionFore(strRefPlanName2, strRefPlanName, strParameterName, ref familyDoc);
				}
				this.AddDimensionPlanAverage("LeftLeft", "Right", HSFamily.m_strLeftRightCenRefName, ref familyDoc);
				this.AddDimensionPlan("LeftLeft", "Right", "净宽", ref familyDoc);
				this.AddDimensionLevel("Elevation" + (nFloorNum - 1).ToString(), "OffsetBaseHigh", ref familyDoc);
				ReferencePlane referencePlane = this.AddReferencePlaneY(-this.dHorB, "BHOffset", ref familyDoc);
				this.AddReferencePlaneY(-this.dHorB / 2.0, "BHOffsetTop", ref familyDoc);
				this.AddReferencePlaneY(-this.dHorB * 1.5, "BHOffsetBottom", ref familyDoc);
				FamilyParameter familyParameter2 = this.AddParametersNoMainSize("BHOffsetPar", this.dHorB, ref familyDoc, true);
				familyDoc.FamilyManager.SetFormula(familyParameter2, "横担宽b/2+竖杆宽b/2");
				this.AddDimensionPlan(HSFamily.m_strForeBackCenRefName, "BHOffset", "BHOffsetPar", ref familyDoc);
				this.AddDimensionPlan("BHOffsetTop", "BHOffsetBottom", "横担宽b", ref familyDoc);
				this.AddDimensionPlanAverage("BHOffsetTop", "BHOffsetBottom", "BHOffset", ref familyDoc);
				CurveArray curveArray = new CurveArray();
				XYZ zero = XYZ.Zero;
				Plane plane = RevitVersionFuncs.CreatePlanByNormalAndOrigin(new XYZ(0.0, -1.0, 0.0), zero);
				SketchPlane sketchPlane = SketchPlane.Create(familyDoc, plane);
				double num8 = HSFamily.mmToFeet(num / 2.0);
				double num9 = HSFamily.mmToFeet(num3);
				familySymbolProfile2.Angle = -Math.PI*.5;
				double num10 = 0.0;
				bool flag3 = curHSType.m_eLinkType != HSLinkType.kLinkBH;
				if (flag3)
				{
					for (int m = 0; m < nFloorNum; m++)
					{
						bool flag4 = m == 0 && curHSType.m_eLinkType == HSLinkType.kLinkDH;
						if (!flag4)
						{
							double num11 = HSFamily.mmToFeet(num6 - (double)m * (num2 + num4) - num4 / 2.0);
							curveArray.Clear();
							curveArray.Append(Line.CreateBound(new XYZ(-num8 + num9, 0.0, num11), new XYZ(num8, 0.0, num11)));
							familyDoc.FamilyCreate.NewSweep(true, curveArray, sketchPlane, familySymbolProfile2, 0, 0);
							this.CreateSolid(curveArray, sketchPlane, familySymbolProfile2, ref familyDoc, true);
						}
					}
				}
				else
				{
					num10 = HSFamily.mmToFeet(this.dHorB);
					double num12 = HSFamily.mmToFeet(this.dHorB);
					SketchPlane sketchPlane2 = SketchPlane.Create(familyDoc, referencePlane.Id);
					for (int n = 0; n < nFloorNum; n++)
					{
						double num13 = HSFamily.mmToFeet(num6 - (double)n * (num2 + num4) - num4 / 2.0);
						curveArray.Clear();
						curveArray.Append(Line.CreateBound(new XYZ(num8 + num12 * 2.0, -num10, num13), new XYZ(-num8, -num10, num13)));
						this.CreateSolid(curveArray, sketchPlane2, familySymbolProfile2, ref familyDoc, true);
					}
				}
				double num14 = HSFamily.mmToFeet(num6);
				num8 = HSFamily.mmToFeet(num / 2.0 + num3 / 2.0);
				familySymbolProfile.Angle = -Math.PI*.5;
				bool flag5 = curHSType.m_eLinkType == HSLinkType.kLinkDH;
				if (flag5)
				{
					num14 = HSFamily.mmToFeet(num6 - num4 / 2.0);
				}
				curveArray.Clear();
				bool flag6 = curHSType.m_eLinkType == HSLinkType.kLinkDH;
				if (flag6)
				{
					curveArray.Append(Line.CreateBound(new XYZ(-num8 + num10 * 2.0, 0.0, num14), new XYZ(num8, 0.0, num14)));
				}
				curveArray.Append(Line.CreateBound(new XYZ(-num8 + num9, 0.0, HSFamily.mmToFeet(num6 + 100.0)), new XYZ(-num8 + num9, 0.0, HSFamily.mmToFeet(num6 - (num2 + num4) * (double)(nFloorNum - 1) - num4 - 100.0))));
				this.CreateSolid(curveArray, sketchPlane, familySymbolProfile, ref familyDoc, true);
				Autodesk.Revit.DB.View view = this.FindElement(typeof(ViewPlan), HSFamily.m_strLevelRefName, ref familyDoc) as Autodesk.Revit.DB.View;
				familyDoc.FamilyCreate.NewControl((Autodesk.Revit.DB.ControlShape)3, view, zero + XYZ.BasisX * HSFamily.mmToFeet(200.0));
				familyDoc.FamilyCreate.NewControl((Autodesk.Revit.DB.ControlShape)2, view, zero);
				this.CreateHSFamilyLabel(-num / 2.0, num / 2.0, ref familyDoc);
				result = true;
			}
			return result;
		}

		private bool CreateHSFamilyElementsZJ_DQ(HSDefineInfo curHSType, ref Autodesk.Revit.DB.Document familyDoc)
		{
			int nFloorNum = curHSType.m_nFloorNum;
			string strCode = curHSType.m_matVer.m_strCode;
			string strCode2 = curHSType.m_matHor.m_strCode;
			double num = 1000.0;
			double num2 = 500.0;
			bool flag = nFloorNum > 5;
			if (flag)
			{
				num2 = 100.0;
			}
			double num3 = this.dHorH;
			double num4 = this.dHorH;
			double num5 = 1000.0;
			double num6 = num4 + (num2 + num4) * (double)(nFloorNum - 1) + num5;
			FamilySymbol familySymbol = this.CreateSectionSymbol(curHSType.m_matVer.m_strCode, ref familyDoc, 1);
			FamilySymbol familySymbol2 = this.CreateSectionSymbol(curHSType.m_matHor.m_strCode, ref familyDoc, 0);
			bool flag2 = familySymbol == null || familySymbol2 == null;
			bool result;
			if (flag2)
			{
				result = false;
			}
			else
			{
				FamilySymbolProfile familySymbolProfile = this.m_revit.Create.NewFamilySymbolProfile(familySymbol);
				FamilySymbolProfile familySymbolProfile2 = this.m_revit.Create.NewFamilySymbolProfile(familySymbol2);
				this.AddReferencePlaneX(num / 2.0, "Right", ref familyDoc);
				this.AddReferencePlaneX(-num / 2.0 + num3, "Left", ref familyDoc);
				this.AddReferencePlaneX(num / 2.0 + num3 / 2.0, "RightCenter", ref familyDoc);
				this.AddReferencePlaneX(-num / 2.0 + num3 / 2.0, "LeftCenter", ref familyDoc);
				this.AddReferencePlaneX(num / 2.0 + num3, "RightRight", ref familyDoc);
				this.AddReferencePlaneX(-num / 2.0, "LeftLeft", ref familyDoc);
				for (int i = 0; i < nFloorNum; i++)
				{
					this.AddReferencePlaneZ(num6 - (num2 + num4) * (double)i, "Elevation" + i.ToString(), ref familyDoc);
					this.AddReferencePlaneZ(num6 - (num2 + num4) * (double)i - num4 / 2.0, "ElevationOffset" + i.ToString(), ref familyDoc);
					this.AddReferencePlaneZ(num6 - (num2 + num4) * (double)i - num4, "ElevationBottom" + i.ToString(), ref familyDoc);
				}
				this.AddReferencePlaneZ(num6 + 100.0, "VertColumnTop", ref familyDoc);
				this.AddReferencePlaneZ(num6 - (num2 + num4) * (double)(nFloorNum - 1) - num4 - 100.0, "VertColumnBottom", ref familyDoc);
				this.AddParameters("顶部延伸", 100.0, ref familyDoc, true);
				this.AddParameters("底部延伸", 100.0, ref familyDoc, true);
				bool bExtendToTop = curHSType.m_bExtendToTop;
				if (bExtendToTop)
				{
					curHSType.m_dTunnelCompartmentHeight += num6;
					this.AddReferencePlaneZ(curHSType.m_dTunnelCompartmentHeight, "CompartmentTop", ref familyDoc);
					this.AddParameters(HSFamily.m_strTunnelHeight, curHSType.m_dTunnelCompartmentHeight, ref familyDoc, true);
				}
				for (int j = 1; j < nFloorNum; j++)
				{
					this.AddParameters("净高" + j.ToString(), num2, ref familyDoc, true);
				}
				this.AddParameters("净宽", num, ref familyDoc, true);
				this.AddParameters(HSFamily.m_strOffsetHigh, num5, ref familyDoc, true);
				FamilyParameter familyParameter = this.AddParametersNoMainSize("OffsetBaseHigh", this.dHorH + num5, ref familyDoc, true);
				familyDoc.FamilyManager.SetFormula(familyParameter, "横担高h+" + HSFamily.m_strOffsetHigh);
				this.AddDimensionPlan("Left", "LeftLeft", "竖杆高h", ref familyDoc);
				this.AddDimensionPlanAverage("Left", "LeftLeft", "LeftCenter", ref familyDoc);
				this.AddDimensionPlan("Right", "RightRight", "竖杆高h", ref familyDoc);
				this.AddDimensionPlanAverage("Right", "RightRight", "RightCenter", ref familyDoc);
				for (int k = 0; k < nFloorNum; k++)
				{
					this.AddDimensionForeAverage("Elevation" + k.ToString(), "ElevationBottom" + k.ToString(), "ElevationOffset" + k.ToString(), ref familyDoc);
					this.AddDimensionFore("Elevation" + k.ToString(), "ElevationBottom" + k.ToString(), "横担高h", ref familyDoc);
				}
				this.AddDimensionFore("VertColumnTop", "Elevation0", "顶部延伸", ref familyDoc);
				this.AddDimensionFore("ElevationBottom" + (nFloorNum - 1).ToString(), "VertColumnBottom", "底部延伸", ref familyDoc);
				double num7 = num6 - num4;
				for (int l = 1; l < nFloorNum; l++)
				{
					string strRefPlanName = "ElevationBottom" + (l - 1).ToString();
					string strRefPlanName2 = "Elevation" + l.ToString();
					string strParameterName = "净高" + l.ToString();
					this.AddDimensionFore(strRefPlanName2, strRefPlanName, strParameterName, ref familyDoc);
				}
				this.AddDimensionPlanAverage("LeftLeft", "Right", HSFamily.m_strLeftRightCenRefName, ref familyDoc);
				this.AddDimensionPlan("LeftLeft", "Right", "净宽", ref familyDoc);
				this.AddDimensionLevel("Elevation" + (nFloorNum - 1).ToString(), "OffsetBaseHigh", ref familyDoc);
				bool bExtendToTop2 = curHSType.m_bExtendToTop;
				if (bExtendToTop2)
				{
					this.AddDimensionPlan(HSFamily.m_strLevelRefName, "CompartmentTop", "舱室净高", ref familyDoc);
				}
				ReferencePlane referencePlane = this.AddReferencePlaneY(-this.dHorB, "BHOffset", ref familyDoc);
				this.AddReferencePlaneY(-this.dHorB / 2.0, "BHOffsetTop", ref familyDoc);
				this.AddReferencePlaneY(-this.dHorB * 1.5, "BHOffsetBottom", ref familyDoc);
				FamilyParameter familyParameter2 = this.AddParametersNoMainSize("BHOffsetPar", this.dHorB, ref familyDoc, true);
				familyDoc.FamilyManager.SetFormula(familyParameter2, "横担宽b/2+竖杆宽b/2");
				this.AddDimensionPlan(HSFamily.m_strForeBackCenRefName, "BHOffset", "BHOffsetPar", ref familyDoc);
				this.AddDimensionPlan("BHOffsetTop", "BHOffsetBottom", "横担宽b", ref familyDoc);
				this.AddDimensionPlanAverage("BHOffsetTop", "BHOffsetBottom", "BHOffset", ref familyDoc);
				CurveArray curveArray = new CurveArray();
				XYZ zero = XYZ.Zero;
				Plane plane = RevitVersionFuncs.CreatePlanByNormalAndOrigin(new XYZ(0.0, -1.0, 0.0), zero);
				SketchPlane sketchPlane = SketchPlane.Create(familyDoc, plane);
				double num8 = HSFamily.mmToFeet(num / 2.0);
				double num9 = HSFamily.mmToFeet(num3);
				familySymbolProfile2.Angle = -Math.PI*.5;
				double num10 = 0.0;
				bool flag3 = curHSType.m_eLinkType != HSLinkType.kLinkBH;
				if (flag3)
				{
					for (int m = 0; m < nFloorNum; m++)
					{
						bool flag4 = m == 0 && curHSType.m_eLinkType == HSLinkType.kLinkDH;
						if (!flag4)
						{
							double num11 = HSFamily.mmToFeet(num6 - (double)m * (num2 + num4) - num4 / 2.0);
							curveArray.Clear();
							curveArray.Append(Line.CreateBound(new XYZ(-num8 + num9, 0.0, num11), new XYZ(num8, 0.0, num11)));
							familyDoc.FamilyCreate.NewSweep(true, curveArray, sketchPlane, familySymbolProfile2, 0, 0);
							this.CreateSolid(curveArray, sketchPlane, familySymbolProfile2, ref familyDoc, true);
						}
					}
				}
				else
				{
					num10 = HSFamily.mmToFeet(this.dHorB);
					double num12 = HSFamily.mmToFeet(this.dHorB);
					SketchPlane sketchPlane2 = SketchPlane.Create(familyDoc, referencePlane.Id);
					for (int n = 0; n < nFloorNum; n++)
					{
						double num13 = HSFamily.mmToFeet(num6 - (double)n * (num2 + num4) - num4 / 2.0);
						curveArray.Clear();
						curveArray.Append(Line.CreateBound(new XYZ(num8 + num12 * 2.0, -num10, num13), new XYZ(-num8, -num10, num13)));
						this.CreateSolid(curveArray, sketchPlane2, familySymbolProfile2, ref familyDoc, true);
					}
				}
				double num14 = HSFamily.mmToFeet(num6);
				num8 = HSFamily.mmToFeet(num / 2.0 + num3 / 2.0);
				familySymbolProfile.Angle = -Math.PI*.5;
				bool flag5 = curHSType.m_eLinkType == HSLinkType.kLinkDH;
				if (flag5)
				{
					num14 = HSFamily.mmToFeet(num6 - num4 / 2.0);
				}
				curveArray.Clear();
				bool flag6 = curHSType.m_eLinkType == HSLinkType.kLinkDH;
				if (flag6)
				{
					curveArray.Append(Line.CreateBound(new XYZ(-num8 + num10 * 2.0, 0.0, num14), new XYZ(num8, 0.0, num14)));
				}
				curveArray.Append(Line.CreateBound(new XYZ(num8, 0.0, 0.0), new XYZ(num8, 0.0, curHSType.m_bExtendToTop ? HSFamily.mmToFeet(curHSType.m_dTunnelCompartmentHeight) : num14)));
				this.CreateSolid(curveArray, sketchPlane, familySymbolProfile, ref familyDoc, true);
				curveArray.Clear();
				curveArray.Append(Line.CreateBound(new XYZ(-num8 + num9, 0.0, HSFamily.mmToFeet(num6 + 100.0)), new XYZ(-num8 + num9, 0.0, HSFamily.mmToFeet(num6 - (num2 + num4) * (double)(nFloorNum - 1) - num4 - 100.0))));
				this.CreateSolid(curveArray, sketchPlane, familySymbolProfile, ref familyDoc, true);
				Autodesk.Revit.DB.View view = this.FindElement(typeof(ViewPlan), HSFamily.m_strLevelRefName, ref familyDoc) as Autodesk.Revit.DB.View;
				familyDoc.FamilyCreate.NewControl((Autodesk.Revit.DB.ControlShape)3, view, zero + XYZ.BasisX * HSFamily.mmToFeet(200.0));
				familyDoc.FamilyCreate.NewControl((Autodesk.Revit.DB.ControlShape)2, view, zero);
				this.CreateHSLinkDevice(new XYZ(num8, 0.0, 0.0), 3, HSFamily.m_strLevelRefName, ref familyDoc, "连接件1", true, HSLinkDevice.kLinkDeviceRect, "Left", false);
				bool bExtendToTop3 = curHSType.m_bExtendToTop;
				if (bExtendToTop3)
				{
					this.CreateHSLinkDevice(new XYZ(num8, 0.0, HSFamily.mmToFeet(curHSType.m_dTunnelCompartmentHeight)), 2, HSFamily.m_strLevelRefName, ref familyDoc, "连接件", true, HSLinkDevice.kLinkDeviceRect, "Left", true);
				}
				this.CreateHSFamilyLabel(-num / 2.0, num / 2.0, ref familyDoc);
				result = true;
			}
			return result;
		}

		private bool CreateHSFamilyElementsZJ_SJ(HSDefineInfo curHSType, ref Autodesk.Revit.DB.Document familyDoc)
		{
			string strCode = curHSType.m_matVer.m_strCode;
			string strCode2 = curHSType.m_matHor.m_strCode;
			string strCode3 = curHSType.m_matLean.m_strCode;
			double num = 1000.0;
			double num2 = 1000.0;
			double num3 = this.dHorB;
			double num4 = this.dHorH;
			double num5 = this.dHorT;
			double num6 = this.dHorM;
			double num7 = this.dHorB;
			double num8 = this.dHorH;
			double num9 = this.dHorT;
			double num10 = this.dHorM;
			double num11 = 800.0;
			double num12 = 800.0;
			double num13 = -num2;
			double num14 = num4;
			double num15 = this.dHorH;
			FamilySymbol familySymbol = this.CreateSectionSymbol(curHSType.m_matHor.m_strCode, ref familyDoc, 0);
			FamilySymbol familySymbol2 = this.CreateSectionSymbol(curHSType.m_matVer.m_strCode, ref familyDoc, 1);
			FamilySymbol familySymbol3 = this.CreateSectionSymbol(curHSType.m_matLean.m_strCode, ref familyDoc, 2);
			bool flag = familySymbol2 == null || familySymbol == null || familySymbol3 == null;
			bool result;
			if (flag)
			{
				result = false;
			}
			else
			{
				FamilySymbolProfile familySymbolProfile = this.m_revit.Create.NewFamilySymbolProfile(familySymbol);
				FamilySymbolProfile familySymbolProfile2 = this.m_revit.Create.NewFamilySymbolProfile(familySymbol2);
				FamilySymbolProfile familySymbolProfile3 = this.m_revit.Create.NewFamilySymbolProfile(familySymbol3);
				XYZ zero = XYZ.Zero;
				Sweep elem = null;
				bool flag2 = curHSType.m_eLinkType == HSLinkType.kLinkCG && strCode == "B";
				if (flag2)
				{
					this.AddParameters("宽", num, ref familyDoc, true);
					this.AddParameters("高", num2, ref familyDoc, true);
					this.AddParameters("斜撑宽", num11, ref familyDoc, true);
					this.AddParameters("斜撑高", num12, ref familyDoc, true);
					this.AddReferencePlaneX(-num / 2.0, "Left", ref familyDoc);
					this.AddReferencePlaneX(num / 2.0, "Right", ref familyDoc);
					this.AddReferencePlaneX(num11 - num / 2.0, "HorDist", ref familyDoc);
					this.AddReferencePlaneZ(-num12, "VerDist", ref familyDoc);
					this.AddReferencePlaneZ(num13, "Bottom", ref familyDoc);
					this.AddReferencePlaneZ(-num15, "HorBottom", ref familyDoc);
					this.AddReferencePlaneZ(-num15 / 2.0, "HorCenter", ref familyDoc);
					this.AddReferencePlaneX(num14 / 2.0 - num5 - num / 2.0, "VerCenter", ref familyDoc);
					this.AddReferencePlaneX(num14 / 2.0 - num5 - num14 / 2.0 - num / 2.0, "VerLeft", ref familyDoc);
					this.AddReferencePlaneX(num14 / 2.0 - num5 + num14 / 2.0 - num / 2.0, "VerRight", ref familyDoc);
					this.AddReferencePlaneZ(-this.dHorT, "HorThick", ref familyDoc);
					ReferencePlane referencePlane = this.AddReferencePlaneY(this.dHorT, "ThickVer", ref familyDoc);
					FamilyParameter familyParameter = this.AddParametersNoMainSize("centerOffsetX", num14 / 2.0 - num5, ref familyDoc, true);
					familyDoc.FamilyManager.SetFormula(familyParameter, "竖杆高h/2-竖杆厚t");
					this.AddDimensionPlanAverage("VerLeft", "VerRight", "VerCenter", ref familyDoc);
					this.AddDimensionPlan("Left", "VerCenter", "centerOffsetX", ref familyDoc);
					this.AddDimensionLevel("HorThick", "横担厚t", ref familyDoc);
					this.AddDimensionForeBack("ThickVer", "竖杆厚t", ref familyDoc);
					this.AddDimensionAverageForeElevation("HorBottom", "HorCenter", ref familyDoc);
					this.AddDimensionLevel("HorBottom", "横担高h", ref familyDoc);
					this.AddDimensionPlanAverage("Left", "Right", HSFamily.m_strLeftRightCenRefName, ref familyDoc);
					this.AddDimensionFore("Left", "Right", "宽", ref familyDoc);
					this.AddDimensionLevel("Bottom", "高", ref familyDoc);
					this.AddDimensionFore("Left", "HorDist", "斜撑宽", ref familyDoc);
					this.AddDimensionLevel("VerDist", "斜撑高", ref familyDoc);
					Plane plane = RevitVersionFuncs.CreatePlanByNormalAndOrigin(new XYZ(0.0, -1.0, 0.0), zero);
					CurveArray curveArray = new CurveArray();
					SketchPlane sketchPlane = SketchPlane.Create(familyDoc, plane);
					double num16 = HSFamily.mmToFeet(num / 2.0);
					familySymbolProfile.Angle = Math.PI*.5;
					double num17 = HSFamily.mmToFeet(num5);
					double num18 = HSFamily.mmToFeet(-num15 / 2.0);
					curveArray.Clear();
					curveArray.Append(Line.CreateBound(new XYZ(-num16, num17, num18), new XYZ(num16, num17, num18)));
					SketchPlane sketchPlane2 = SketchPlane.Create(familyDoc, referencePlane.Id);
					this.CreateSolid(curveArray, sketchPlane2, familySymbolProfile, ref familyDoc, true);
					double num19 = 0.0;
					double num20 = HSFamily.mmToFeet(num13);
					num16 = HSFamily.mmToFeet(num14 / 2.0 - num5 - num / 2.0);
					familySymbolProfile2.Angle = -Math.PI*.5;
					curveArray.Clear();
					curveArray.Append(Line.CreateBound(new XYZ(num16, 0.0, num20), new XYZ(num16, 0.0, num19)));
					this.CreateSolid(ref elem, curveArray, sketchPlane, familySymbolProfile2, ref familyDoc, true);
					FamilyParameter familyParameter2 = this.AddParametersByGroup("是否有竖杆", true, ref familyDoc, (Autodesk.Revit.DB.BuiltInParameterGroup)(-5000101), true);
					familyDoc.FamilyManager.AssociateElementParameterToFamilyParameter(elem.GetParameter(Autodesk.Revit.DB.BuiltInParameter.IS_VISIBLE_PARAM), familyParameter2);
					double num21 = Math.Cos(Math.Atan(num11 / num12));
					double num22 = Math.Sin(Math.Atan(num11 / num12));
					double num23 = num8 / 2.0 * num21;
					double num24 = num8 / 2.0 * num22;
					num17 = HSFamily.mmToFeet(this.dHorT);
					this.AddReferencePlaneX(num11 + num23 - num / 2.0, "UPX", ref familyDoc);
					FamilyParameter familyParameter3 = this.AddParametersNoMainSize("XA", num23, ref familyDoc, true);
					this.AddDimensionPlan("HorDist", "UPX", "XA", ref familyDoc);
					familyDoc.FamilyManager.SetFormula(familyParameter3, "斜杆高h/2*cos(atan(斜撑宽/斜撑高))");
					bool flag3 = strCode2 == "B";
					if (flag3)
					{
						this.AddReferencePlaneZ(-this.dHorT - num24, "UPY", ref familyDoc);
					}
					else
					{
						this.AddReferencePlaneZ(-this.dHorH - num24, "UPY", ref familyDoc);
					}
					FamilyParameter familyParameter4 = this.AddParametersNoMainSize("YA", num24, ref familyDoc, true);
					bool flag4 = strCode2 == "B";
					if (flag4)
					{
						this.AddDimensionFore("HorThick", "UPY", "YA", ref familyDoc);
						familyDoc.FamilyManager.SetFormula(familyParameter4, "斜杆高h/2*sin(atan(斜撑宽/斜撑高))");
					}
					else
					{
						this.AddDimensionLevelUp("UPY", "YA", ref familyDoc);
						familyDoc.FamilyManager.SetFormula(familyParameter4, "横担高h+斜杆高h/2*sin(atan(斜撑宽/斜撑高))");
					}
					ReferencePlane referencePlane2 = this.AddReferencePlaneY(this.dHorT, "ThickLean", ref familyDoc);
					this.AddReferencePlaneX(num23 - num / 2.0, "DOWNX", ref familyDoc);
					FamilyParameter familyParameter5 = this.AddParametersNoMainSize("XB", num23, ref familyDoc, true);
					this.AddDimensionPlan("Left", "DOWNX", "XB", ref familyDoc);
					familyDoc.FamilyManager.SetFormula(familyParameter5, "斜杆高h/2*cos(atan(斜撑宽/斜撑高))");
					this.AddReferencePlaneZ(-num12 - num24, "DOWNY", ref familyDoc);
					FamilyParameter familyParameter6 = this.AddParametersNoMainSize("YB", -num24, ref familyDoc, true);
					this.AddDimensionFore("VerDist", "DOWNY", "YB", ref familyDoc);
					familyDoc.FamilyManager.SetFormula(familyParameter6, "斜杆高h/2*sin(atan(斜撑宽/斜撑高))");
					familySymbolProfile3.Angle = Math.PI*.5;
					SketchPlane sketchPlane3 = SketchPlane.Create(familyDoc, referencePlane2.Id);
					curveArray.Clear();
					bool flag5 = strCode2 == "B";
					if (flag5)
					{
						curveArray.Append(Line.CreateBound(new XYZ(HSFamily.mmToFeet(num23 - num / 2.0), num17, HSFamily.mmToFeet(-num12 - num24)), new XYZ(HSFamily.mmToFeet(num11 + num23 - num / 2.0), num17, num19 - HSFamily.mmToFeet(this.dHorT + num24))));
					}
					else
					{
						curveArray.Append(Line.CreateBound(new XYZ(HSFamily.mmToFeet(num23 - num / 2.0), num17, HSFamily.mmToFeet(-num12 - num24)), new XYZ(HSFamily.mmToFeet(num11 + num23 - num / 2.0), num17, num19 - HSFamily.mmToFeet(this.dHorH + num24))));
					}
					this.CreateSolid(ref elem, curveArray, sketchPlane3, familySymbolProfile3, ref familyDoc, true);
					FamilyParameter familyParameter7 = this.AddParametersByGroup("是否有斜撑", true, ref familyDoc, (Autodesk.Revit.DB.BuiltInParameterGroup)(-5000101), true);
					familyDoc.FamilyManager.AssociateElementParameterToFamilyParameter(elem.GetParameter(Autodesk.Revit.DB.BuiltInParameter.IS_VISIBLE_PARAM), familyParameter7);
				}
				else
				{
					this.AddReferencePlaneX(-num / 2.0, "Left", ref familyDoc);
					this.AddReferencePlaneX(num / 2.0, "Right", ref familyDoc);
					this.AddReferencePlaneX(num11 - num / 2.0, "HorDist", ref familyDoc);
					this.AddReferencePlaneZ(-num12, "VerDist", ref familyDoc);
					this.AddReferencePlaneZ(num13, "Bottom", ref familyDoc);
					this.AddReferencePlaneZ(-num15, "HorBottom", ref familyDoc);
					this.AddReferencePlaneZ(-num15 / 2.0, "HorCenter", ref familyDoc);
					this.AddReferencePlaneX(-num14 / 2.0 - num / 2.0, "VerCenter", ref familyDoc);
					this.AddReferencePlaneX(-num14 - num / 2.0, "VerLeft", ref familyDoc);
					this.AddParameters("宽", num, ref familyDoc, true);
					this.AddParameters("高", num2, ref familyDoc, true);
					this.AddParameters("斜撑宽", num11, ref familyDoc, true);
					this.AddParameters("斜撑高", num12, ref familyDoc, true);
					this.AddDimensionPlan("Left", "Right", "宽", ref familyDoc);
					this.AddDimensionLevelUp("Bottom", "高", ref familyDoc);
					this.AddDimensionPlanAverage("Left", "Right", HSFamily.m_strLeftRightCenRefName, ref familyDoc);
					this.AddDimensionPlan("Left", "HorDist", "斜撑宽", ref familyDoc);
					this.AddDimensionLevelUp("VerDist", "斜撑高", ref familyDoc);
					this.AddDimensionAverageForeElevation("HorBottom", "HorCenter", ref familyDoc);
					this.AddDimensionLevelUp("HorBottom", "横担高h", ref familyDoc);
					this.AddDimensionPlanAverage("VerLeft", "Left", "VerCenter", ref familyDoc);
					this.AddDimensionPlan("VerLeft", "Left", "竖杆高h", ref familyDoc);
					Plane plane2 = RevitVersionFuncs.CreatePlanByNormalAndOrigin(new XYZ(0.0, -1.0, 0.0), zero);
					CurveArray curveArray2 = new CurveArray();
					SketchPlane sketchPlane4 = SketchPlane.Create(familyDoc, plane2);
					double num25 = HSFamily.mmToFeet(num / 2.0);
					double num26 = HSFamily.mmToFeet(0.0);
					double num27 = HSFamily.mmToFeet(num13);
					familySymbolProfile.Angle = Math.PI*.5;
					double num28 = HSFamily.mmToFeet(-num15 / 2.0);
					curveArray2.Clear();
					bool flag6 = curHSType.m_eLinkType == HSLinkType.kLinkDH;
					if (flag6)
					{
						double num29 = HSFamily.mmToFeet(num14 / 2.0 + num / 2.0);
						curveArray2.Append(Line.CreateBound(new XYZ(num25, 0.0, num28), new XYZ(-num29, 0.0, num28)));
						curveArray2.Append(Line.CreateBound(new XYZ(-num29, 0.0, num27), new XYZ(-num29, 0.0, num28)));
					}
					else
					{
						curveArray2.Append(Line.CreateBound(new XYZ(num25, 0.0, num28), new XYZ(-num25, 0.0, num28)));
					}
					this.CreateSolid(curveArray2, sketchPlane4, familySymbolProfile, ref familyDoc, true);
					num25 = HSFamily.mmToFeet(num14 / 2.0 + num / 2.0);
					familySymbolProfile2.Angle = Math.PI*.5;
					curveArray2.Clear();
					bool flag7 = curHSType.m_eLinkType != HSLinkType.kLinkDH;
					if (flag7)
					{
						curveArray2.Append(Line.CreateBound(new XYZ(-num25, 0.0, num27), new XYZ(-num25, 0.0, num26)));
						this.CreateSolid(ref elem, curveArray2, sketchPlane4, familySymbolProfile2, ref familyDoc, true);
						FamilyParameter familyParameter8 = this.AddParametersByGroup("是否有竖杆", true, ref familyDoc, (Autodesk.Revit.DB.BuiltInParameterGroup)(-5000101), true);
						familyDoc.FamilyManager.AssociateElementParameterToFamilyParameter(elem.GetParameter(Autodesk.Revit.DB.BuiltInParameter.IS_VISIBLE_PARAM), familyParameter8);
					}
					double num30 = Math.Cos(Math.Atan(num11 / num12));
					double num31 = Math.Sin(Math.Atan(num11 / num12));
					double num32 = num8 / 2.0 * num30;
					double num33 = num8 / 2.0 * num31;
					this.AddReferencePlaneX(num11 + num32 - num / 2.0, "UPX", ref familyDoc);
					FamilyParameter familyParameter9 = this.AddParametersNoMainSize("XA", num32, ref familyDoc, true);
					this.AddDimensionPlan("HorDist", "UPX", "XA", ref familyDoc);
					familyDoc.FamilyManager.SetFormula(familyParameter9, "斜杆高h/2*cos(atan(斜撑宽/斜撑高))");
					double num34 = this.dHorH;
					bool flag8 = curHSType.m_eLinkType == HSLinkType.kLinkBH;
					if (flag8)
					{
						num34 = 0.0;
					}
					this.AddReferencePlaneZ(-num34 - num33, "UPY", ref familyDoc);
					FamilyParameter familyParameter10 = this.AddParametersNoMainSize("YA", num33, ref familyDoc, true);
					bool flag9 = curHSType.m_eLinkType == HSLinkType.kLinkBH;
					if (flag9)
					{
						this.AddDimensionLevelUp("UPY", "YA", ref familyDoc);
						familyDoc.FamilyManager.SetFormula(familyParameter10, "斜杆高h/2*sin(atan(斜撑宽/斜撑高))");
					}
					else
					{
						this.AddDimensionLevelUp("UPY", "YA", ref familyDoc);
						familyDoc.FamilyManager.SetFormula(familyParameter10, "横担高h+斜杆高h/2*sin(atan(斜撑宽/斜撑高))");
					}
					bool flag10 = curHSType.m_eLinkType == HSLinkType.kLinkBH;
					if (flag10)
					{
						this.AddReferencePlaneX(-num4 + num32 - num / 2.0, "DOWNX", ref familyDoc);
						FamilyParameter familyParameter11 = this.AddParametersNoMainSize("XB", num32, ref familyDoc, true);
						this.AddDimensionPlan("DOWNX", "VerLeft", "XB", ref familyDoc);
						familyDoc.FamilyManager.SetFormula(familyParameter11, "斜杆高h/2*cos(atan(斜撑宽/斜撑高))");
					}
					else
					{
						this.AddReferencePlaneX(num32 - num / 2.0, "DOWNX", ref familyDoc);
						FamilyParameter familyParameter12 = this.AddParametersNoMainSize("XB", num32, ref familyDoc, true);
						this.AddDimensionPlan("DOWNX", "Left", "XB", ref familyDoc);
						familyDoc.FamilyManager.SetFormula(familyParameter12, "斜杆高h/2*cos(atan(斜撑宽/斜撑高))");
					}
					this.AddReferencePlaneZ(-num12 - num33, "DOWNY", ref familyDoc);
					FamilyParameter familyParameter13 = this.AddParametersNoMainSize("YB", -num33, ref familyDoc, true);
					this.AddDimensionFore("VerDist", "DOWNY", "YB", ref familyDoc);
					familyDoc.FamilyManager.SetFormula(familyParameter13, "斜杆高h/2*sin(atan(斜撑宽/斜撑高))");
					familySymbolProfile3.Angle = Math.PI*.5;
					curveArray2.Clear();
					SketchPlane sketchPlane5 = sketchPlane4;
					double num35 = 0.0;
					double num36 = 0.0;
					bool flag11 = curHSType.m_eLinkType == HSLinkType.kLinkBH;
					if (flag11)
					{
						ReferencePlane referencePlane3 = this.AddReferencePlaneY(this.dHorB, "BHOffset", ref familyDoc);
						FamilyParameter familyParameter14 = this.AddParametersNoMainSize("BHOffsetPar", this.dHorB, ref familyDoc, true);
						familyDoc.FamilyManager.SetFormula(familyParameter14, "横担宽b/2+斜杆宽b/2");
						this.AddDimensionPlan(HSFamily.m_strForeBackCenRefName, "BHOffset", "BHOffsetPar", ref familyDoc);
						sketchPlane5 = SketchPlane.Create(familyDoc, referencePlane3.Id);
						num35 = HSFamily.mmToFeet((this.dHorB + num7) / 2.0);
						num36 = num4;
					}
					bool flag12 = curHSType.m_eLinkType == HSLinkType.kLinkBH;
					if (flag12)
					{
						curveArray2.Append(Line.CreateBound(new XYZ(HSFamily.mmToFeet(num32 - num36 - num / 2.0), num35, HSFamily.mmToFeet(-num12 - num33)), new XYZ(HSFamily.mmToFeet(num11 + num32 - num / 2.0), num35, num26 - HSFamily.mmToFeet(num34 + num33))));
					}
					else
					{
						curveArray2.Append(Line.CreateBound(new XYZ(HSFamily.mmToFeet(num11 + num32 - num / 2.0), num35, num26 - HSFamily.mmToFeet(num34 + num33)), new XYZ(HSFamily.mmToFeet(num32 - num36 - num / 2.0), num35, HSFamily.mmToFeet(-num12 - num33))));
					}
					this.CreateSolid(ref elem, curveArray2, sketchPlane5, familySymbolProfile3, ref familyDoc, true);
					FamilyParameter familyParameter15 = this.AddParametersByGroup("是否有斜撑", true, ref familyDoc, (Autodesk.Revit.DB.BuiltInParameterGroup)(-5000101), true);
					familyDoc.FamilyManager.AssociateElementParameterToFamilyParameter(elem.GetParameter(Autodesk.Revit.DB.BuiltInParameter.IS_VISIBLE_PARAM), familyParameter15);
				}
				XYZ xyz = new XYZ(-HSFamily.mmToFeet(num / 2.0), 0.0, 0.0);
				Plane plane3 = RevitVersionFuncs.CreatePlanByNormalAndOrigin(XYZ.BasisY, XYZ.Zero);
				SketchPlane sketchPlane6 = SketchPlane.Create(familyDoc, plane3);
				Line line = YJKLineEx.YJKGetBound(xyz, xyz + new XYZ(0.0, 0.0, HSFamily.mmToFeet(1.0)));
				familyDoc.FamilyCreate.NewModelCurve(line, sketchPlane6);
				Autodesk.Revit.DB.View view = this.FindElement(typeof(ViewPlan), HSFamily.m_strLevelRefName, ref familyDoc) as Autodesk.Revit.DB.View;
				familyDoc.FamilyCreate.NewControl((Autodesk.Revit.DB.ControlShape)3, view, zero + XYZ.BasisX * HSFamily.mmToFeet(200.0));
				familyDoc.FamilyCreate.NewControl((Autodesk.Revit.DB.ControlShape)2, view, zero);
				this.CreateHSFamilyLabel(0.0, num, ref familyDoc);
				result = true;
			}
			return result;
		}

		private bool CreateHSFamilyElementsZJ_XB(HSDefineInfo curHSType, ref Autodesk.Revit.DB.Document familyDoc)
		{
			string strCode = curHSType.m_matHor.m_strCode;
			double num = 1000.0;
			double num2 = this.dHorH;
			FamilySymbol familySymbol = this.CreateSectionSymbol(curHSType.m_matHor.m_strCode, ref familyDoc, 0);
			bool flag = familySymbol == null;
			bool result;
			if (flag)
			{
				result = false;
			}
			else
			{
				FamilySymbolProfile curProfile = this.m_revit.Create.NewFamilySymbolProfile(familySymbol);
				this.AddReferencePlaneX(-num / 2.0, "Left", ref familyDoc);
				this.AddReferencePlaneX(num / 2.0, "Right", ref familyDoc);
				ReferencePlane referencePlane = this.AddReferencePlaneZ(-num2 / 2.0, "ElevationOffset", ref familyDoc);
				this.AddReferencePlaneZ(-num2, "ElevationBottom", ref familyDoc);
				this.AddParameters("净宽", num, ref familyDoc, true);
				this.AddDimensionLevelUp("ElevationBottom", "横担高h", ref familyDoc);
				this.AddDimensionAverageForeElevation("ElevationBottom", "ElevationOffset", ref familyDoc);
				this.AddDimensionPlan("Left", "Right", "净宽", ref familyDoc);
				XYZ zero = XYZ.Zero;
				CurveArray curveArray = new CurveArray();
				SketchPlane sketchPlane = SketchPlane.Create(familyDoc, referencePlane.Id);
				double num3 = HSFamily.mmToFeet(num / 2.0);
				double num4 = HSFamily.mmToFeet(-num2 / 2.0);
				curveArray.Clear();
				curveArray.Append(Line.CreateBound(new XYZ(-num3, 0.0, num4), new XYZ(num3, 0.0, num4)));
				this.CreateSolid(curveArray, sketchPlane, curProfile, ref familyDoc, true);
				Autodesk.Revit.DB.View view = this.FindElement(typeof(ViewPlan), HSFamily.m_strLevelRefName, ref familyDoc) as Autodesk.Revit.DB.View;
				familyDoc.FamilyCreate.NewControl((Autodesk.Revit.DB.ControlShape)3, view, zero + XYZ.BasisX * HSFamily.mmToFeet(200.0));
				familyDoc.FamilyCreate.NewControl((Autodesk.Revit.DB.ControlShape)2, view, zero);
				this.AddDimensionPlanAverage("Left", "Right", HSFamily.m_strLeftRightCenRefName, ref familyDoc);
				this.CreateHSLinkDevice(new XYZ(-num3, 0.0, num4), 0, HSFamily.m_strForeBackCenRefName, ref familyDoc, "连接件1", true, HSLinkDevice.kLinkDeviceRect, "Left", false);
				this.CreateHSFamilyLabel(0.0, num, ref familyDoc);
				result = true;
			}
			return result;
		}

		private bool CreateHSFamilyElementsZJ_CB(HSDefineInfo curHSType, ref Autodesk.Revit.DB.Document familyDoc)
		{
			string strCode = curHSType.m_matHor.m_strCode;
			double num = 1000.0;
			double num2 = this.dHorH;
			double num3 = 500.0;
			double num4 = 20.0;
			double num5 = 15.0;
			double num6 = 50.0;
			double num7 = num3 / 2.0;
			double num8 = (num7 + num5 + num4) * 2.0;
			FamilySymbol familySymbol = this.CreateSectionSymbol(curHSType.m_matHor.m_strCode, ref familyDoc, 0);
			bool flag = familySymbol == null;
			bool result;
			if (flag)
			{
				result = false;
			}
			else
			{
				FamilySymbolProfile curProfile = this.m_revit.Create.NewFamilySymbolProfile(familySymbol);
				double num9 = num / 2.0 + num8 / 2.0;
				this.AddReferencePlaneX(-num / 2.0, "Left", ref familyDoc);
				this.AddReferencePlaneX(num / 2.0, "Right", ref familyDoc);
				this.AddReferencePlaneX(num / 2.0 + num8 / 2.0, "LoopMid", ref familyDoc);
				this.AddReferencePlaneX(num / 2.0 + num8, "LoopRight", ref familyDoc);
				ReferencePlane referencePlane = this.AddReferencePlaneZ(num2 / 2.0, "ElevationTop", ref familyDoc);
				this.AddReferencePlaneZ(-num2 / 2.0, "ElevationBottom", ref familyDoc);
				this.AddReferencePlaneZ(num6 / 2.0, "LoopTop", ref familyDoc);
				this.AddReferencePlaneZ(-num6 / 2.0, "LoopBottom", ref familyDoc);
				this.AddReferencePlaneY(num6 / 2.0, "LoopFore", ref familyDoc);
				this.AddReferencePlaneY(-num6 / 2.0, "LoopBack", ref familyDoc);
				this.AddParameters("净宽", num, ref familyDoc, true);
				FamilyParameter familyParameter = this.AddParametersByGroup("是否竖管", false, ref familyDoc, (Autodesk.Revit.DB.BuiltInParameterGroup)(-5000101), true);
				this.AddDimensionFore("ElevationTop", "ElevationBottom", "横担高h", ref familyDoc);
				this.AddDimensionPlan("Left", "Right", "净宽", ref familyDoc);
				this.AddDimensionAverageForeElevation("ElevationBottom", "ElevationTop", ref familyDoc);
				this.AddDimensionPlanAverage("Left", "Right", HSFamily.m_strLeftRightCenRefName, ref familyDoc);
				this.AddParameters("管径", num3, ref familyDoc, true);
				this.AddParameters("管径偏移量", num5, ref familyDoc, true);
				FamilyParameter familyParameter2 = this.AddParameters("管箍厚度", num5, ref familyDoc, true);
				this.AddParameters("管箍长度", num6 * 2.0, ref familyDoc, true);
				FamilyParameter familyParameter3 = this.AddParametersNoMainSize("管箍外径", num8, ref familyDoc, true);
				this.AddDimensionForeAverage("Right", "LoopRight", "LoopMid", ref familyDoc);
				this.AddDimensionPlan("Right", "LoopRight", "管箍外径", ref familyDoc);
				this.AddDimensionFore("LoopTop", "LoopBottom", "管箍长度", ref familyDoc);
				this.AddDimensionPlan("LoopFore", "LoopBack", "管箍长度", ref familyDoc);
				this.AddDimensionAverageForeElevation("LoopTop", "LoopBottom", ref familyDoc);
				this.AddDimensionPlanAverage("LoopFore", "LoopBack", HSFamily.m_strForeBackCenRefName, ref familyDoc);
				FamilyParameter familyParameter4 = this.AddParametersByGroup("是否横管", true, ref familyDoc, (Autodesk.Revit.DB.BuiltInParameterGroup)(-5000101), true);
				familyDoc.FamilyManager.SetFormula(familyParameter4, "not(是否竖管)");
				familyDoc.FamilyManager.SetFormula(familyParameter3, "管径+2*(管径偏移量+管箍厚度)");
				XYZ zero = XYZ.Zero;
				CurveArray curveArray = new CurveArray();
				Plane plane = RevitVersionFuncs.CreatePlanByNormalAndOrigin(XYZ.BasisY, XYZ.Zero);
				SketchPlane sketchPlane = SketchPlane.Create(familyDoc, plane);
				double num10 = HSFamily.mmToFeet(num / 2.0);
				curveArray.Clear();
				curveArray.Append(Line.CreateBound(new XYZ(-num10, 0.0, 0.0), new XYZ(num10, 0.0, 0.0)));
				this.CreateSolid(curveArray, sketchPlane, curProfile, ref familyDoc, true);
				Autodesk.Revit.DB.View view = this.FindElement(typeof(ViewPlan), HSFamily.m_strLevelRefName, ref familyDoc) as Autodesk.Revit.DB.View;
				familyDoc.FamilyCreate.NewControl((Autodesk.Revit.DB.ControlShape)3, view, zero + XYZ.BasisX * HSFamily.mmToFeet(200.0));
				familyDoc.FamilyCreate.NewControl((Autodesk.Revit.DB.ControlShape)2, view, zero);
				string text = "I";
				Family family = null;
				FamilySymbol familySymbol2 = null;
				this.CreateSectionFamily(text, false);
				this.LoadSectionFamily(ref family, ref familySymbol2, 1, text, familyDoc);
				FamilySymbol familySymbol3 = null;
				this.CreateSectionFamily(text, false);
				this.LoadSectionFamily(ref family, ref familySymbol3, 0, text, familyDoc);
				bool flag2 = familySymbol2 == null || familySymbol3 == null;
				if (flag2)
				{
					result = false;
				}
				else
				{
					familyDoc.FamilyManager.AssociateElementParameterToFamilyParameter(familySymbol2.GetParameter("Wide"), familyParameter3);
					familyDoc.FamilyManager.AssociateElementParameterToFamilyParameter(familySymbol2.GetParameter("High"), familyParameter3);
					familyDoc.FamilyManager.AssociateElementParameterToFamilyParameter(familySymbol2.GetParameter("Thick"), familyParameter2);
					familyDoc.FamilyManager.AssociateElementParameterToFamilyParameter(familySymbol3.GetParameter("Wide"), familyParameter3);
					familyDoc.FamilyManager.AssociateElementParameterToFamilyParameter(familySymbol3.GetParameter("High"), familyParameter3);
					familyDoc.FamilyManager.AssociateElementParameterToFamilyParameter(familySymbol3.GetParameter("Thick"), familyParameter2);
					Sweep elem = null;
					double num11 = HSFamily.mmToFeet(num9 - 5.0);
					FamilySymbolProfile curProfile2 = this.m_revit.Create.NewFamilySymbolProfile(familySymbol2);
					curveArray.Clear();
					curveArray.Append(Line.CreateBound(new XYZ(num11, 0.0, HSFamily.mmToFeet(-num6 / 2.0)), new XYZ(num11, 0.0, HSFamily.mmToFeet(num6 / 2.0))));
					this.CreateSolid(ref elem, curveArray, sketchPlane, curProfile2, ref familyDoc, true);
					familyDoc.FamilyManager.AssociateElementParameterToFamilyParameter(elem.GetParameter(Autodesk.Revit.DB.BuiltInParameter.IS_VISIBLE_PARAM), familyParameter);
					Plane plane2 = RevitVersionFuncs.CreatePlanByNormalAndOrigin(XYZ.BasisZ, XYZ.Zero);
					sketchPlane = SketchPlane.Create(familyDoc, plane2);
					FamilySymbolProfile curProfile3 = this.m_revit.Create.NewFamilySymbolProfile(familySymbol3);
					curveArray.Clear();
					curveArray.Append(Line.CreateBound(new XYZ(num11, HSFamily.mmToFeet(-num6 / 2.0), 0.0), new XYZ(num11, HSFamily.mmToFeet(num6 / 2.0), 0.0)));
					this.CreateSolid(ref elem, curveArray, sketchPlane, curProfile3, ref familyDoc, true);
					familyDoc.FamilyManager.AssociateElementParameterToFamilyParameter(elem.GetParameter(Autodesk.Revit.DB.BuiltInParameter.IS_VISIBLE_PARAM), familyParameter4);
					this.CreateHSLinkDevice(new XYZ(-num10, 0.0, 0.0), 0, HSFamily.m_strForeBackCenRefName, ref familyDoc, "连接件1", true, HSLinkDevice.kLinkDeviceRect, "Left", false);
					this.CreateHSFamilyLabel(0.0, num, ref familyDoc);
					result = true;
				}
			}
			return result;
		}

		private bool CreateHSFamilyElementsDJ_DC3(HSDefineInfo curHSType, ref Autodesk.Revit.DB.Document familyDoc, bool bHasPX = false)
		{
			return this.CreateHSFamilyElementsDJ_DC(curHSType, ref familyDoc, bHasPX);
		}

		private bool CreateHSFamilyElementsDJ_DC(HSDefineInfo curHSType, ref Autodesk.Revit.DB.Document familyDoc, bool bHasPX = false)
		{
			int nFloorNum = curHSType.m_nFloorNum;
			string strCode = curHSType.m_matVer.m_strCode;
			string strCode2 = curHSType.m_matHor.m_strCode;
			double num = 1000.0;
			double num2 = 500.0;
			double mmVal = this.dHorH;
			double num3 = this.dHorB;
			double num4 = this.dHorH;
			double num5 = this.dHorH;
			bool flag = nFloorNum > 5;
			if (flag)
			{
				num2 = 100.0;
			}
			double num6 = 777.0;
			double dDistFromGround = curHSType.m_dDistFromGround;
			double num7 = -dDistFromGround;
			num7 -= (double)(nFloorNum - 1) * (num5 + num2);
			FamilySymbol familySymbol = this.CreateSectionSymbol(curHSType.m_matVer.m_strCode, ref familyDoc, 1);
			FamilySymbol familySymbol2 = this.CreateSectionSymbol(curHSType.m_matHor.m_strCode, ref familyDoc, 0);
			bool flag2 = familySymbol == null || familySymbol2 == null;
			bool result;
			if (flag2)
			{
				result = false;
			}
			else
			{
				FamilySymbolProfile familySymbolProfile = this.m_revit.Create.NewFamilySymbolProfile(familySymbol);
				FamilySymbolProfile familySymbolProfile2 = this.m_revit.Create.NewFamilySymbolProfile(familySymbol2);
				this.AddParameters(HSFamily.m_strOffsetHigh, dDistFromGround, ref familyDoc, true);
				FamilyParameter familyParameter = this.AddParametersNoMainSize("OffsetBaseHigh", this.dHorH + dDistFromGround, ref familyDoc, true);
				familyDoc.FamilyManager.SetFormula(familyParameter, "横担高h + " + HSFamily.m_strOffsetHigh);
				this.AddReferencePlaneX(num / 2.0, "Right", ref familyDoc);
				this.AddReferencePlaneX(-num / 2.0, "Left", ref familyDoc);
				this.AddReferencePlaneX(num / 2.0 + num4 / 2.0, "RightCenter", ref familyDoc);
				this.AddReferencePlaneX(-num / 2.0 - num4 / 2.0, "LeftCenter", ref familyDoc);
				this.AddReferencePlaneX(num / 2.0 + num4, "RightCenterRight", ref familyDoc);
				this.AddReferencePlaneX(-num / 2.0 - num4, "LeftCenterLeft", ref familyDoc);
				this.AddReferencePlaneX(num / 2.0 - curHSType.m_dOffsetX - num4, "MidBar", ref familyDoc);
				this.AddReferencePlaneX(num / 2.0 - curHSType.m_dOffsetX - num4 / 2.0, "MidBarRight", ref familyDoc);
				this.AddReferencePlaneX(num / 2.0 - curHSType.m_dOffsetX - 3.0 * num4 / 2.0, "MidBarLeft", ref familyDoc);
				for (int i = 0; i < nFloorNum; i++)
				{
					this.AddReferencePlaneZ(num7 + (num2 + num5) * (double)i, "Elevation" + i.ToString(), ref familyDoc);
					this.AddReferencePlaneZ(num7 + (num2 + num5) * (double)i - num5 / 2.0, "ElevationOffset" + i.ToString(), ref familyDoc);
					this.AddReferencePlaneZ(num7 + (num2 + num5) * (double)i - num5, "ElevationSecBottom" + i.ToString(), ref familyDoc);
				}
				for (int j = 1; j < nFloorNum; j++)
				{
					this.AddParameters("净高" + j.ToString(), num2 + num5, ref familyDoc, true);
				}
				this.AddParameters("净宽", num, ref familyDoc, true);
				bool flag3 = curHSType.m_eType == HSType.kDJ_DC3 || curHSType.m_eType == HSType.kDJ_PX3;
				if (flag3)
				{
					this.AddParameters("中杆净宽", curHSType.m_dOffsetX, ref familyDoc, true);
				}
				FamilyParameter familyParameter2 = this.AddParametersNoMainSize("HalfHighVer", num4 / 2.0, ref familyDoc, true);
				familyDoc.FamilyManager.SetFormula(familyParameter2, "竖杆高h/2");
				double mmVal2 = num / 2.0 - curHSType.m_dOffsetX - num4;
				this.AddDimensionPlan("Left", "LeftCenterLeft", "竖杆高h", ref familyDoc);
				this.AddDimensionPlanAverage("Left", "LeftCenterLeft", "LeftCenter", ref familyDoc);
				this.AddDimensionPlan("Right", "RightCenterRight", "竖杆高h", ref familyDoc);
				this.AddDimensionPlanAverage("Right", "RightCenterRight", "RightCenter", ref familyDoc);
				bool flag4 = curHSType.m_eType == HSType.kDJ_DC3 || curHSType.m_eType == HSType.kDJ_PX3;
				if (flag4)
				{
					this.AddDimensionPlan("Right", "MidBarRight", "中杆净宽", ref familyDoc);
					this.AddDimensionPlan("MidBarRight", "MidBar", "HalfHighVer", ref familyDoc);
					this.AddDimensionPlanAverage("MidBarRight", "MidBarLeft", "MidBar", ref familyDoc);
				}
				double num8 = num7 - num5;
				for (int k = 1; k < nFloorNum; k++)
				{
					string strRefPlanName = "Elevation" + (k - 1).ToString();
					string strRefPlanName2 = "ElevationSecBottom" + k.ToString();
					string strParameterName = "净高" + k.ToString();
					this.AddDimensionFore(strRefPlanName, strRefPlanName2, strParameterName, ref familyDoc);
				}
				this.AddDimensionPlanAverage("Left", "Right", HSFamily.m_strLeftRightCenRefName, ref familyDoc);
				this.AddDimensionPlan("Left", "Right", "净宽", ref familyDoc);
				for (int l = 0; l < nFloorNum; l++)
				{
					this.AddDimensionForeAverage("Elevation" + l.ToString(), "ElevationSecBottom" + l.ToString(), "ElevationOffset" + l.ToString(), ref familyDoc);
					bool flag5 = curHSType.IsLink_DH() && l == 0;
					if (flag5)
					{
						this.AddDimensionFore("Elevation" + l.ToString(), "ElevationSecBottom" + l.ToString(), "竖杆高h", ref familyDoc);
					}
					else
					{
						this.AddDimensionFore("Elevation" + l.ToString(), "ElevationSecBottom" + l.ToString(), "横担高h", ref familyDoc);
					}
				}
				this.AddDimensionLevelUp("ElevationSecBottom" + (nFloorNum - 1).ToString(), "OffsetBaseHigh", ref familyDoc);
				ReferencePlane referencePlane = this.AddReferencePlaneY(-this.dHorB, "BHOffset", ref familyDoc);
				this.AddReferencePlaneY(-this.dHorB / 2.0, "BHOffsetTop", ref familyDoc);
				this.AddReferencePlaneY(-this.dHorB * 1.5, "BHOffsetBottom", ref familyDoc);
				FamilyParameter familyParameter3 = this.AddParametersNoMainSize("BHOffsetPar", this.dHorB, ref familyDoc, true);
				familyDoc.FamilyManager.SetFormula(familyParameter3, "横担宽b/2+竖杆宽b/2");
				this.AddDimensionPlan(HSFamily.m_strForeBackCenRefName, "BHOffset", "BHOffsetPar", ref familyDoc);
				this.AddDimensionPlan("BHOffsetTop", "BHOffsetBottom", "横担宽b", ref familyDoc);
				this.AddDimensionPlanAverage("BHOffsetTop", "BHOffsetBottom", "BHOffset", ref familyDoc);
				XYZ zero = XYZ.Zero;
				Plane plane = RevitVersionFuncs.CreatePlanByNormalAndOrigin(new XYZ(0.0, -1.0, 0.0), zero);
				CurveArray curveArray = new CurveArray();
				SketchPlane sketchPlane = SketchPlane.Create(familyDoc, plane);
				SketchPlane sketchPlane2 = null;
				double num9 = HSFamily.mmToFeet(num / 2.0);
				familySymbolProfile2.Angle = -Math.PI*.5;
				bool flag6 = curHSType.m_eLinkType != HSLinkType.kLinkBH;
				if (flag6)
				{
					for (int m = 0; m < nFloorNum; m++)
					{
						bool flag7 = m == 0 && curHSType.m_eLinkType == HSLinkType.kLinkDH;
						if (!flag7)
						{
							double num10 = HSFamily.mmToFeet(num7 + (double)m * (num2 + num5) - num5 / 2.0);
							curveArray.Clear();
							curveArray.Append(Line.CreateBound(new XYZ(-num9, 0.0, num10), new XYZ(num9, 0.0, num10)));
							this.CreateSolid(curveArray, sketchPlane, familySymbolProfile2, ref familyDoc, true);
						}
					}
				}
				else
				{
					double num11 = HSFamily.mmToFeet(this.dHorB);
					double num12 = HSFamily.mmToFeet(mmVal);
					sketchPlane2 = SketchPlane.Create(familyDoc, referencePlane.Id);
					for (int n = 0; n < nFloorNum; n++)
					{
						double num13 = HSFamily.mmToFeet(num7 + (double)n * (num2 + num5) - num5 / 2.0);
						curveArray.Clear();
						bool flag8 = n == 0 && bHasPX;
						if (flag8)
						{
							curveArray.Append(Line.CreateBound(new XYZ(-num9, 0.0, num13), new XYZ(num9, 0.0, num13)));
							this.CreateSolid(curveArray, sketchPlane, familySymbolProfile2, ref familyDoc, true);
						}
						else
						{
							curveArray.Append(Line.CreateBound(new XYZ(num9 + num12, -num11, num13), new XYZ(-num9 - num12, -num11, num13)));
							this.CreateSolid(curveArray, sketchPlane2, familySymbolProfile2, ref familyDoc, true);
						}
					}
				}
				Level level = this.FindElement(typeof(Level), HSFamily.m_strLevelUpRefName, ref familyDoc) as Level;
				double elevation = level.Elevation;
				double num14 = HSFamily.mmToFeet(num7 - num5);
				num9 = HSFamily.mmToFeet(num / 2.0 + num4 / 2.0);
				familySymbolProfile.Angle = -Math.PI*.5;
				bool flag9 = curHSType.m_eLinkType == HSLinkType.kLinkDH;
				if (flag9)
				{
					num14 = HSFamily.mmToFeet(num7 - num5 / 2.0);
				}
				curveArray.Clear();
				curveArray.Append(Line.CreateBound(new XYZ(-num9, 0.0, elevation), new XYZ(-num9, 0.0, num14)));
				double num15 = HSFamily.mmToFeet(num7 - num2 - 2.0 * num5);
				bool flag10 = curHSType.m_eLinkType == HSLinkType.kLinkDH;
				if (flag10)
				{
					if (bHasPX)
					{
						curveArray.Append(Line.CreateBound(new XYZ(-num9, 0.0, num14), new XYZ(num9 - HSFamily.mmToFeet(num4 / 2.0), 0.0, num14)));
					}
					else
					{
						curveArray.Append(Line.CreateBound(new XYZ(-num9, 0.0, num14), new XYZ(num9, 0.0, num14)));
						curveArray.Append(Line.CreateBound(new XYZ(num9, 0.0, num14), new XYZ(num9, 0.0, elevation)));
					}
					this.CreateSolid(curveArray, sketchPlane, familySymbolProfile, ref familyDoc, true);
					curveArray.Clear();
				}
				else
				{
					this.CreateSolid(curveArray, sketchPlane, familySymbolProfile, ref familyDoc, true);
					curveArray.Clear();
					bool flag11 = !bHasPX;
					if (flag11)
					{
						curveArray.Append(Line.CreateBound(new XYZ(num9, 0.0, num14), new XYZ(num9, 0.0, elevation)));
						this.CreateSolid(curveArray, sketchPlane, familySymbolProfile, ref familyDoc, true);
					}
				}
				Autodesk.Revit.DB.View view = this.FindElement(typeof(ViewPlan), HSFamily.m_strLevelRefName, ref familyDoc) as Autodesk.Revit.DB.View;
				familyDoc.FamilyCreate.NewControl((Autodesk.Revit.DB.ControlShape)3, view, zero + XYZ.BasisX * HSFamily.mmToFeet(200.0));
				familyDoc.FamilyCreate.NewControl((Autodesk.Revit.DB.ControlShape)2, view, zero);
				this.CreateHSLinkDevice(new XYZ(num9, 0.0, elevation), 2, HSFamily.m_strLevelUpRefName, ref familyDoc, "连接件1", true, HSLinkDevice.kLinkDeviceRect, "Left", false);
				this.CreateHSLinkDevice(new XYZ(-num9, 0.0, elevation), 2, HSFamily.m_strLevelUpRefName, ref familyDoc, "连接件2", false, HSLinkDevice.kLinkDeviceRect, "Left", false);
				bool flag12 = curHSType.m_eType == HSType.kDJ_DC3 || curHSType.m_eType == HSType.kDJ_PX3;
				if (flag12)
				{
					curveArray.Clear();
					double num16 = 0.0;
					bool flag13 = !curHSType.IsLink_BH();
					if (flag13)
					{
						num16 = -HSFamily.mmToFeet(this.dHorB);
						double num17 = 0.0;
						bool flag14 = curHSType.IsLink_DH();
						if (flag14)
						{
							num17 = HSFamily.mmToFeet(num4 / 2.0);
						}
						curveArray.Append(Line.CreateBound(new XYZ(HSFamily.mmToFeet(mmVal2), num16, num14 - num17), new XYZ(HSFamily.mmToFeet(mmVal2), num16, elevation)));
						sketchPlane2 = SketchPlane.Create(familyDoc, referencePlane.Id);
						this.CreateSolid(curveArray, sketchPlane2, familySymbolProfile, ref familyDoc, true);
						this.CreateHSLinkDeviceNew(new XYZ(HSFamily.mmToFeet(mmVal2), num16, elevation), 2, HSFamily.m_strLevelUpRefName, "BHOffset", ref familyDoc, "连接件3", false, HSLinkDevice.kLinkDeviceRect);
					}
					else
					{
						double num18 = 0.0;
						bool flag15 = bHasPX && curHSType.IsLink_BH();
						if (flag15)
						{
							num18 = HSFamily.mmToFeet(num5);
						}
						curveArray.Append(Line.CreateBound(new XYZ(HSFamily.mmToFeet(mmVal2), 0.0, num14 + num18), new XYZ(HSFamily.mmToFeet(mmVal2), 0.0, elevation)));
						this.CreateSolid(curveArray, sketchPlane, familySymbolProfile, ref familyDoc, true);
						this.CreateHSLinkDevice(new XYZ(HSFamily.mmToFeet(mmVal2), num16, elevation), 2, HSFamily.m_strLevelUpRefName, ref familyDoc, "连接件3", false, HSLinkDevice.kLinkDeviceRect, "Left", false);
					}
				}
				if (bHasPX)
				{
					num14 = HSFamily.mmToFeet(num7 - num5);
					this.AddReferencePlaneZ(num7 - num2 - num5, "ElevationPXUp", ref familyDoc);
					this.AddReferencePlaneZ(num7 - num2 - num5 - num5 / 2.0, "ElevationPX", ref familyDoc);
					this.AddReferencePlaneZ(num7 - num2 - num5 - num5, "ElevationPXDown", ref familyDoc);
					this.AddReferencePlaneX(num / 2.0 - num6 - num4, "ElevationPXXLeft", ref familyDoc);
					this.AddReferencePlaneX(num / 2.0 - num6 - num4 / 2.0, "ElevationPXX", ref familyDoc);
					this.AddReferencePlaneX(num / 2.0 - num6, "ElevationPXXRight", ref familyDoc);
					this.AddParameters("偏心净高", num2, ref familyDoc, true);
					this.AddParameters("偏心净宽", num6, ref familyDoc, true);
					this.AddDimensionFore("ElevationPXXRight", "Right", "偏心净宽", ref familyDoc);
					this.AddDimensionFore("ElevationSecBottom0", "ElevationPXUp", "偏心净高", ref familyDoc);
					this.AddDimensionForeAverage("ElevationPXUp", "ElevationPXDown", "ElevationPX", ref familyDoc);
					this.AddDimensionFore("ElevationPXUp", "ElevationPXDown", "横担高h", ref familyDoc);
					this.AddDimensionPlan("ElevationPXXLeft", "ElevationPXXRight", "竖杆高h", ref familyDoc);
					this.AddDimensionPlanAverage("ElevationPXXLeft", "ElevationPXXRight", "ElevationPXX", ref familyDoc);
					double num19 = HSFamily.mmToFeet(num / 2.0 - num6 - num4 / 2.0);
					curveArray.Clear();
					double num20 = HSFamily.mmToFeet(num7 - num2 - 2.0 * num5);
					bool flag16 = curHSType.m_eLinkType == HSLinkType.kLinkDH;
					if (flag16)
					{
						num20 += HSFamily.mmToFeet(num5 / 2.0);
					}
					bool flag17 = curHSType.m_eLinkType == HSLinkType.kLinkDH;
					if (flag17)
					{
						curveArray.Append(Line.CreateBound(new XYZ(num9, 0.0, num20), new XYZ(num9, 0.0, elevation)));
						curveArray.Append(Line.CreateBound(new XYZ(num19, 0.0, num20), new XYZ(num9, 0.0, num20)));
						curveArray.Append(Line.CreateBound(new XYZ(num19, 0.0, num14), new XYZ(num19, 0.0, num20)));
						this.CreateSolid(curveArray, sketchPlane, familySymbolProfile, ref familyDoc, true);
						curveArray.Clear();
					}
					else
					{
						curveArray.Append(Line.CreateBound(new XYZ(num9, 0.0, num20), new XYZ(num9, 0.0, elevation)));
						this.CreateSolid(curveArray, sketchPlane, familySymbolProfile, ref familyDoc, true);
						curveArray.Clear();
						curveArray.Append(Line.CreateBound(new XYZ(num19, 0.0, num14), new XYZ(num19, 0.0, num20)));
						this.CreateSolid(curveArray, sketchPlane, familySymbolProfile, ref familyDoc, true);
					}
					bool flag18 = curHSType.m_eLinkType == HSLinkType.kLinkCG;
					if (flag18)
					{
						curveArray.Clear();
						double num21 = HSFamily.mmToFeet(num4 / 2.0);
						curveArray.Append(Line.CreateBound(new XYZ(num19 + num21, 0.0, HSFamily.mmToFeet(num7 - num2 - 1.5 * num5)), new XYZ(num9 - num21, 0.0, HSFamily.mmToFeet(num7 - num2 - 1.5 * num5))));
						this.CreateSolid(curveArray, sketchPlane, familySymbolProfile2, ref familyDoc, true);
					}
					else
					{
						bool flag19 = curHSType.m_eLinkType == HSLinkType.kLinkBH;
						if (flag19)
						{
							curveArray.Clear();
							double num22 = HSFamily.mmToFeet(num4 / 2.0);
							double num23 = HSFamily.mmToFeet(this.dHorB);
							curveArray.Append(Line.CreateBound(new XYZ(num9, -num23, HSFamily.mmToFeet(num7 - num2 - 1.5 * num5)), new XYZ(num19 - num22, -num23, HSFamily.mmToFeet(num7 - num2 - 1.5 * num5))));
							this.CreateSolid(curveArray, sketchPlane2, familySymbolProfile2, ref familyDoc, true);
						}
					}
				}
				this.CreateHSFamilyLabel(-num / 2.0, num / 2.0, ref familyDoc);
				result = true;
			}
			return result;
		}

		private bool CreateHSFamilyElementsDJ_DZ(HSDefineInfo curHSType, ref Autodesk.Revit.DB.Document familyDoc)
		{
			int nFloorNum = curHSType.m_nFloorNum;
			string strCode = curHSType.m_matVer.m_strCode;
			string strCode2 = curHSType.m_matHor.m_strCode;
			double num = 1000.0;
			double num2 = 500.0;
			double num3 = this.dHorH;
			double num4 = this.dHorB;
			double num5 = this.dHorH;
			double num6 = this.dHorH;
			bool flag = nFloorNum > 5;
			if (flag)
			{
				num2 = 100.0;
			}
			double dDistFromGround = curHSType.m_dDistFromGround;
			double num7 = -dDistFromGround;
			num7 -= (double)(nFloorNum - 1) * (num6 + num2);
			FamilySymbol familySymbol = this.CreateSectionSymbol(curHSType.m_matVer.m_strCode, ref familyDoc, 1);
			FamilySymbol familySymbol2 = this.CreateSectionSymbol(curHSType.m_matHor.m_strCode, ref familyDoc, 0);
			bool flag2 = familySymbol == null || familySymbol2 == null;
			bool result;
			if (flag2)
			{
				result = false;
			}
			else
			{
				FamilySymbolProfile familySymbolProfile = this.m_revit.Create.NewFamilySymbolProfile(familySymbol);
				FamilySymbolProfile familySymbolProfile2 = this.m_revit.Create.NewFamilySymbolProfile(familySymbol2);
				this.AddParameters(HSFamily.m_strOffsetHigh, dDistFromGround, ref familyDoc, true);
				FamilyParameter familyParameter = this.AddParametersNoMainSize("OffsetBaseHigh", this.dHorH + dDistFromGround, ref familyDoc, true);
				familyDoc.FamilyManager.SetFormula(familyParameter, "横担高h + " + HSFamily.m_strOffsetHigh);
				this.AddReferencePlaneX(num / 2.0, "Right", ref familyDoc);
				this.AddReferencePlaneX(-num / 2.0, "Left", ref familyDoc);
				this.AddReferencePlaneX(num / 2.0 + num5 / 2.0, "RightCenter", ref familyDoc);
				this.AddReferencePlaneX(num / 2.0 + num5, "RightCenterRight", ref familyDoc);
				for (int i = 0; i < nFloorNum; i++)
				{
					this.AddReferencePlaneZ(num7 + (num2 + num6) * (double)i, "Elevation" + i.ToString(), ref familyDoc);
					this.AddReferencePlaneZ(num7 + (num2 + num6) * (double)i - num6 / 2.0, "ElevationOffset" + i.ToString(), ref familyDoc);
					this.AddReferencePlaneZ(num7 + (num2 + num6) * (double)i - num6, "ElevationSecBottom" + i.ToString(), ref familyDoc);
				}
				for (int j = 1; j < nFloorNum; j++)
				{
					this.AddParameters("净高" + j.ToString(), num2 + num6, ref familyDoc, true);
				}
				this.AddParameters("净宽", num, ref familyDoc, true);
				FamilyParameter familyParameter2 = this.AddParametersNoMainSize("HalfHighVer", num5 / 2.0, ref familyDoc, true);
				familyDoc.FamilyManager.SetFormula(familyParameter2, "竖杆高h/2");
				double num8 = num / 2.0 - curHSType.m_dOffsetX - num5;
				this.AddDimensionPlan("Left", "LeftCenterLeft", "竖杆高h", ref familyDoc);
				this.AddDimensionPlanAverage("Left", "LeftCenterLeft", "LeftCenter", ref familyDoc);
				this.AddDimensionPlan("Right", "RightCenterRight", "竖杆高h", ref familyDoc);
				this.AddDimensionPlanAverage("Right", "RightCenterRight", "RightCenter", ref familyDoc);
				double num9 = num7 - num6;
				for (int k = 1; k < nFloorNum; k++)
				{
					string strRefPlanName = "Elevation" + (k - 1).ToString();
					string strRefPlanName2 = "ElevationSecBottom" + k.ToString();
					string strParameterName = "净高" + k.ToString();
					this.AddDimensionFore(strRefPlanName, strRefPlanName2, strParameterName, ref familyDoc);
				}
				this.AddDimensionPlanAverage("Left", "Right", HSFamily.m_strLeftRightCenRefName, ref familyDoc);
				this.AddDimensionPlan("Left", "Right", "净宽", ref familyDoc);
				for (int l = 0; l < nFloorNum; l++)
				{
					this.AddDimensionForeAverage("Elevation" + l.ToString(), "ElevationSecBottom" + l.ToString(), "ElevationOffset" + l.ToString(), ref familyDoc);
					bool flag3 = curHSType.IsLink_DH() && l == 0;
					if (flag3)
					{
						this.AddDimensionFore("Elevation" + l.ToString(), "ElevationSecBottom" + l.ToString(), "竖杆高h", ref familyDoc);
					}
					else
					{
						this.AddDimensionFore("Elevation" + l.ToString(), "ElevationSecBottom" + l.ToString(), "横担高h", ref familyDoc);
					}
				}
				this.AddDimensionLevelUp("ElevationSecBottom" + (nFloorNum - 1).ToString(), "OffsetBaseHigh", ref familyDoc);
				double num10 = HSFamily.mmToFeet(num / 2.0);
				ReferencePlane referencePlane = this.AddReferencePlaneY(-this.dHorB, "BHOffset", ref familyDoc);
				this.AddReferencePlaneY(-this.dHorB / 2.0, "BHOffsetTop", ref familyDoc);
				this.AddReferencePlaneY(-this.dHorB * 1.5, "BHOffsetBottom", ref familyDoc);
				FamilyParameter familyParameter3 = this.AddParametersNoMainSize("BHOffsetPar", this.dHorB, ref familyDoc, true);
				familyDoc.FamilyManager.SetFormula(familyParameter3, "横担宽b/2+竖杆宽b/2");
				this.AddDimensionPlan(HSFamily.m_strForeBackCenRefName, "BHOffset", "BHOffsetPar", ref familyDoc);
				this.AddDimensionPlan("BHOffsetTop", "BHOffsetBottom", "横担宽b", ref familyDoc);
				this.AddDimensionPlanAverage("BHOffsetTop", "BHOffsetBottom", "BHOffset", ref familyDoc);
				XYZ zero = XYZ.Zero;
				Plane plane = RevitVersionFuncs.CreatePlanByNormalAndOrigin(new XYZ(0.0, -1.0, 0.0), zero);
				CurveArray curveArray = new CurveArray();
				SketchPlane sketchPlane = SketchPlane.Create(familyDoc, plane);
				familySymbolProfile2.Angle = -Math.PI*.5;
				double num11 = 0.0;
				bool flag4 = curHSType.m_eLinkType != HSLinkType.kLinkBH;
				if (flag4)
				{
					for (int m = 0; m < nFloorNum; m++)
					{
						bool flag5 = m == 0 && curHSType.m_eLinkType == HSLinkType.kLinkDH;
						if (!flag5)
						{
							double num12 = HSFamily.mmToFeet(num7 + (double)m * (num2 + num6) - num6 / 2.0);
							curveArray.Clear();
							curveArray.Append(Line.CreateBound(new XYZ(-num10, 0.0, num12), new XYZ(num10, 0.0, num12)));
							this.CreateSolid(curveArray, sketchPlane, familySymbolProfile2, ref familyDoc, true);
						}
					}
				}
				else
				{
					num11 = HSFamily.mmToFeet(this.dHorB);
					double num13 = HSFamily.mmToFeet(num3);
					SketchPlane sketchPlane2 = SketchPlane.Create(familyDoc, referencePlane.Id);
					for (int n = 0; n < nFloorNum; n++)
					{
						double num14 = HSFamily.mmToFeet(num7 + (double)n * (num2 + num6) - num6 / 2.0);
						curveArray.Clear();
						curveArray.Append(Line.CreateBound(new XYZ(num10 + num13, -num11, num14), new XYZ(-num10, -num11, num14)));
						this.CreateSolid(curveArray, sketchPlane2, familySymbolProfile2, ref familyDoc, true);
					}
				}
				Level level = this.FindElement(typeof(Level), HSFamily.m_strLevelUpRefName, ref familyDoc) as Level;
				double elevation = level.Elevation;
				double num15 = HSFamily.mmToFeet(num7 - num6);
				num10 = HSFamily.mmToFeet(num / 2.0 + num5 / 2.0);
				familySymbolProfile.Angle = -Math.PI*.5;
				bool flag6 = curHSType.m_eLinkType == HSLinkType.kLinkDH;
				if (flag6)
				{
					num15 = HSFamily.mmToFeet(num7 - num6 / 2.0);
				}
				curveArray.Clear();
				bool flag7 = curHSType.m_eLinkType == HSLinkType.kLinkDH;
				if (flag7)
				{
					curveArray.Append(Line.CreateBound(new XYZ(-num10 + HSFamily.mmToFeet(num3 / 2.0), 0.0, num15), new XYZ(num10, 0.0, num15)));
				}
				curveArray.Append(Line.CreateBound(new XYZ(num10, 0.0, num15), new XYZ(num10, 0.0, elevation)));
				this.CreateSolid(curveArray, sketchPlane, familySymbolProfile, ref familyDoc, true);
				Autodesk.Revit.DB.View view = this.FindElement(typeof(ViewPlan), HSFamily.m_strLevelRefName, ref familyDoc) as Autodesk.Revit.DB.View;
				familyDoc.FamilyCreate.NewControl((Autodesk.Revit.DB.ControlShape)3, view, zero + XYZ.BasisX * HSFamily.mmToFeet(200.0));
				familyDoc.FamilyCreate.NewControl((Autodesk.Revit.DB.ControlShape)2, view, zero);
				this.CreateHSLinkDevice(new XYZ(num10, 0.0, elevation), 2, HSFamily.m_strLevelUpRefName, ref familyDoc, "连接件1", true, HSLinkDevice.kLinkDeviceRect, "Left", false);
				num10 = HSFamily.mmToFeet(num / 2.0);
				string strRefPlanName3 = "BHOffset";
				bool flag8 = curHSType.m_eLinkType != HSLinkType.kLinkBH;
				if (flag8)
				{
					strRefPlanName3 = HSFamily.m_strForeBackCenRefName;
				}
				for (int num16 = 0; num16 < nFloorNum; num16++)
				{
					double num17 = HSFamily.mmToFeet(num7 + (double)num16 * (num2 + num6) - num6 / 2.0);
					this.CreateHSLinkDevice(new XYZ(-num10, -num11, num17), 0, strRefPlanName3, ref familyDoc, "连接件" + (num16 + 2).ToString(), num16 == 0, HSLinkDevice.kLinkDeviceRect, "Left", false);
				}
				this.CreateHSFamilyLabel(-num / 2.0, num / 2.0, ref familyDoc);
				result = true;
			}
			return result;
		}

		private bool CreateHSFamilyElementsDJ_PX(HSDefineInfo curHSType, ref Autodesk.Revit.DB.Document familyDoc)
		{
			return this.CreateHSFamilyElementsDJ_DC(curHSType, ref familyDoc, true);
		}

		private bool CreateHSFamilyElementsDJ_PX3(HSDefineInfo curHSType, ref Autodesk.Revit.DB.Document familyDoc)
		{
			return this.CreateHSFamilyElementsDJ_DC3(curHSType, ref familyDoc, true);
		}

		private bool CreateHSFamilyElementsDJ_BD(HSDefineInfo curHSType, ref Autodesk.Revit.DB.Document familyDoc, bool bHasPX = false)
		{
			int nFloorNum = curHSType.m_nFloorNum;
			string strCode = curHSType.m_matVer.m_strCode;
			string strCode2 = curHSType.m_matHor.m_strCode;
			double num = 1000.0;
			double num2 = 500.0;
			double mmVal = this.dHorH;
			double num3 = this.dHorB;
			double num4 = 2500.0;
			double num5 = 2600.0;
			double num6 = this.dHorH;
			double num7 = this.dHorH;
			bool flag = nFloorNum > 5;
			if (flag)
			{
				num2 = 100.0;
			}
			double num8 = 600.0;
			double dDistFromGround = curHSType.m_dDistFromGround;
			double num9 = -dDistFromGround;
			num9 -= (double)(nFloorNum - 1) * (num7 + num2);
			FamilySymbol familySymbol = this.CreateSectionSymbol(curHSType.m_matVer.m_strCode, ref familyDoc, 1);
			FamilySymbol familySymbol2 = this.CreateSectionSymbol(curHSType.m_matHor.m_strCode, ref familyDoc, 0);
			bool flag2 = familySymbol == null || familySymbol2 == null;
			bool result;
			if (flag2)
			{
				result = false;
			}
			else
			{
				FamilySymbolProfile familySymbolProfile = this.m_revit.Create.NewFamilySymbolProfile(familySymbol);
				FamilySymbolProfile familySymbolProfile2 = this.m_revit.Create.NewFamilySymbolProfile(familySymbol2);
				this.AddReferencePlaneX(num / 2.0, "Right", ref familyDoc);
				this.AddReferencePlaneX(-num / 2.0, "Left", ref familyDoc);
				this.AddReferencePlaneX(num / 2.0 + num6 / 2.0, "RightCenter", ref familyDoc);
				this.AddReferencePlaneX(-num / 2.0 - num6 / 2.0, "LeftCenter", ref familyDoc);
				this.AddReferencePlaneX(num / 2.0 + num6, "RightCenterRight", ref familyDoc);
				this.AddReferencePlaneX(-num / 2.0 - num6, "LeftCenterLeft", ref familyDoc);
				for (int i = 0; i < nFloorNum; i++)
				{
					this.AddReferencePlaneZ(num9 + (num2 + num7) * (double)i, "Elevation" + i.ToString(), ref familyDoc);
					this.AddReferencePlaneZ(num9 + (num2 + num7) * (double)i - num7 / 2.0, "ElevationOffset" + i.ToString(), ref familyDoc);
					this.AddReferencePlaneZ(num9 + (num2 + num7) * (double)i - num7, "ElevationSecBottom" + i.ToString(), ref familyDoc);
				}
				this.AddReferencePlaneZ(num9 + num4, "ElevationLeft", ref familyDoc);
				this.AddReferencePlaneZ(num9 + num5, "ElevationRight", ref familyDoc);
				for (int j = 1; j < nFloorNum; j++)
				{
					this.AddParameters("净高" + j.ToString(), num2 + num7, ref familyDoc, true);
				}
				this.AddParameters("净宽", num, ref familyDoc, true);
				this.AddParameters(HSFamily.m_strOffsetHigh, dDistFromGround, ref familyDoc, true);
				this.AddParameters("左高", num4, ref familyDoc, true);
				this.AddParameters("右高", num5, ref familyDoc, true);
				this.AddDimensionFore("ElevationLeft", "ElevationSecBottom0", "左高", ref familyDoc);
				this.AddDimensionFore("ElevationRight", "ElevationSecBottom0", "右高", ref familyDoc);
				this.AddDimensionPlan("Left", "LeftCenterLeft", "竖杆高h", ref familyDoc);
				this.AddDimensionPlanAverage("Left", "LeftCenterLeft", "LeftCenter", ref familyDoc);
				this.AddDimensionPlan("Right", "RightCenterRight", "竖杆高h", ref familyDoc);
				this.AddDimensionPlanAverage("Right", "RightCenterRight", "RightCenter", ref familyDoc);
				for (int k = 0; k < nFloorNum; k++)
				{
					this.AddDimensionForeAverage("Elevation" + k.ToString(), "ElevationSecBottom" + k.ToString(), "ElevationOffset" + k.ToString(), ref familyDoc);
					this.AddDimensionFore("Elevation" + k.ToString(), "ElevationSecBottom" + k.ToString(), "横担高h", ref familyDoc);
				}
				double num10 = num9 - num7;
				for (int l = 1; l < nFloorNum; l++)
				{
					string strRefPlanName = "Elevation" + (l - 1).ToString();
					string strRefPlanName2 = "ElevationSecBottom" + l.ToString();
					string strParameterName = "净高" + l.ToString();
					this.AddDimensionFore(strRefPlanName, strRefPlanName2, strParameterName, ref familyDoc);
				}
				this.AddDimensionPlanAverage("Left", "Right", HSFamily.m_strLeftRightCenRefName, ref familyDoc);
				this.AddDimensionPlan("Left", "Right", "净宽", ref familyDoc);
				this.AddParameters(HSFamily.m_strOffsetHigh, dDistFromGround, ref familyDoc, true);
				FamilyParameter familyParameter = this.AddParametersNoMainSize("OffsetBaseHigh", this.dHorH + dDistFromGround, ref familyDoc, true);
				familyDoc.FamilyManager.SetFormula(familyParameter, "横担高h + " + HSFamily.m_strOffsetHigh);
				this.AddDimensionLevelUp("ElevationSecBottom" + (nFloorNum - 1).ToString(), "OffsetBaseHigh", ref familyDoc);
				string strName = "";
				bool flag3 = curHSType.m_eLinkType == HSLinkType.kLinkBH;
				if (flag3)
				{
					strName = "BHOffset";
				}
				ReferencePlane referencePlane = this.AddReferencePlaneY(-this.dHorB, strName, ref familyDoc);
				this.AddReferencePlaneY(-this.dHorB / 2.0, "BHOffsetTop", ref familyDoc);
				this.AddReferencePlaneY(-this.dHorB * 1.5, "BHOffsetBottom", ref familyDoc);
				FamilyParameter familyParameter2 = this.AddParametersNoMainSize("BHOffsetPar", this.dHorB, ref familyDoc, true);
				familyDoc.FamilyManager.SetFormula(familyParameter2, "横担宽b/2+竖杆宽b/2");
				this.AddDimensionPlan(HSFamily.m_strForeBackCenRefName, "BHOffset", "BHOffsetPar", ref familyDoc);
				this.AddDimensionPlan("BHOffsetTop", "BHOffsetBottom", "横担宽b", ref familyDoc);
				this.AddDimensionPlanAverage("BHOffsetTop", "BHOffsetBottom", "BHOffset", ref familyDoc);
				XYZ zero = XYZ.Zero;
				Plane plane = RevitVersionFuncs.CreatePlanByNormalAndOrigin(new XYZ(0.0, -1.0, 0.0), zero);
				CurveArray curveArray = new CurveArray();
				SketchPlane sketchPlane = SketchPlane.Create(familyDoc, plane);
				SketchPlane sketchPlane2 = null;
				double num11 = HSFamily.mmToFeet(num / 2.0);
				familySymbolProfile2.Angle = -Math.PI*.5;
				bool flag4 = curHSType.m_eLinkType != HSLinkType.kLinkBH;
				if (flag4)
				{
					for (int m = 0; m < nFloorNum; m++)
					{
						bool flag5 = m == 0 && curHSType.m_eLinkType == HSLinkType.kLinkDH;
						if (!flag5)
						{
							double num12 = HSFamily.mmToFeet(num9 + (double)m * (num2 + num7) - num7 / 2.0);
							curveArray.Clear();
							curveArray.Append(Line.CreateBound(new XYZ(-num11, 0.0, num12), new XYZ(num11, 0.0, num12)));
							this.CreateSolid(curveArray, sketchPlane, familySymbolProfile2, ref familyDoc, true);
						}
					}
				}
				else
				{
					double num13 = HSFamily.mmToFeet(this.dHorB);
					double num14 = HSFamily.mmToFeet(mmVal);
					sketchPlane2 = SketchPlane.Create(familyDoc, referencePlane.Id);
					for (int n = 0; n < nFloorNum; n++)
					{
						double num15 = HSFamily.mmToFeet(num9 + (double)n * (num2 + num7) - num7 / 2.0);
						curveArray.Clear();
						bool flag6 = n == 0 && bHasPX;
						if (flag6)
						{
							curveArray.Append(Line.CreateBound(new XYZ(-num11, 0.0, num15), new XYZ(num11, 0.0, num15)));
							this.CreateSolid(curveArray, sketchPlane, familySymbolProfile2, ref familyDoc, true);
						}
						else
						{
							curveArray.Append(Line.CreateBound(new XYZ(num11 + num14, -num13, num15), new XYZ(-num11 - num14, -num13, num15)));
							this.CreateSolid(curveArray, sketchPlane2, familySymbolProfile2, ref familyDoc, true);
						}
					}
				}
				Level level = this.FindElement(typeof(Level), HSFamily.m_strLevelUpRefName, ref familyDoc) as Level;
				double num16 = HSFamily.mmToFeet(num9 + num4);
				double num17 = HSFamily.mmToFeet(num9 + num5);
				double num18 = HSFamily.mmToFeet(num9 - num7);
				num11 = HSFamily.mmToFeet(num / 2.0 + num6 / 2.0);
				familySymbolProfile.Angle = -Math.PI*.5;
				bool flag7 = curHSType.m_eLinkType == HSLinkType.kLinkDH;
				if (flag7)
				{
					num18 = HSFamily.mmToFeet(num9 - num7 / 2.0);
				}
				curveArray.Clear();
				curveArray.Append(Line.CreateBound(new XYZ(-num11, 0.0, num16), new XYZ(-num11, 0.0, num18)));
				bool flag8 = curHSType.m_eLinkType == HSLinkType.kLinkDH;
				if (flag8)
				{
					curveArray.Append(Line.CreateBound(new XYZ(-num11, 0.0, num18), new XYZ(num11, 0.0, num18)));
				}
				else
				{
					this.CreateSolid(curveArray, sketchPlane, familySymbolProfile, ref familyDoc, true);
					curveArray.Clear();
				}
				curveArray.Append(Line.CreateBound(new XYZ(num11, 0.0, num18), new XYZ(num11, 0.0, num17)));
				this.CreateSolid(curveArray, sketchPlane, familySymbolProfile, ref familyDoc, true);
				Autodesk.Revit.DB.View view = this.FindElement(typeof(ViewPlan), HSFamily.m_strLevelRefName, ref familyDoc) as Autodesk.Revit.DB.View;
				familyDoc.FamilyCreate.NewControl((Autodesk.Revit.DB.ControlShape)3, view, zero + XYZ.BasisX * HSFamily.mmToFeet(200.0));
				familyDoc.FamilyCreate.NewControl((Autodesk.Revit.DB.ControlShape)2, view, zero);
				this.CreateHSLinkDeviceNew(new XYZ(num11, 0.0, num17), 2, "ElevationRight", "", ref familyDoc, "连接件1", true, HSLinkDevice.kLinkDeviceRect);
				this.CreateHSLinkDeviceNew(new XYZ(-num11, 0.0, num16), 2, "ElevationLeft", "", ref familyDoc, "连接件2", false, HSLinkDevice.kLinkDeviceRect);
				if (bHasPX)
				{
					num18 = HSFamily.mmToFeet(num9 - num7);
					this.AddReferencePlaneZ(num9 - num2 - num7, "ElevationPXUp", ref familyDoc);
					this.AddReferencePlaneZ(num9 - num2 - num7 - num7 / 2.0, "ElevationPX", ref familyDoc);
					this.AddReferencePlaneZ(num9 - num2 - num7 - num7, "ElevationPXDown", ref familyDoc);
					this.AddReferencePlaneX(num / 2.0 - num8 - num6, "ElevationPXXLeft", ref familyDoc);
					this.AddReferencePlaneX(num / 2.0 - num8 - num6 / 2.0, "ElevationPXX", ref familyDoc);
					this.AddReferencePlaneX(num / 2.0 - num8, "ElevationPXXRight", ref familyDoc);
					this.AddParameters("偏心净高", num2, ref familyDoc, true);
					this.AddParameters("偏心净宽", num8, ref familyDoc, true);
					this.AddDimensionFore("ElevationPXXRight", "Right", "偏心净宽", ref familyDoc);
					this.AddDimensionFore("ElevationSecBottom0", "ElevationPXUp", "偏心净高", ref familyDoc);
					this.AddDimensionForeAverage("ElevationPXUp", "ElevationPXDown", "ElevationPX", ref familyDoc);
					this.AddDimensionFore("ElevationPXUp", "ElevationPXDown", "横担高h", ref familyDoc);
					this.AddDimensionPlan("ElevationPXXLeft", "ElevationPXXRight", "竖杆高h", ref familyDoc);
					this.AddDimensionPlanAverage("ElevationPXXLeft", "ElevationPXXRight", "ElevationPXX", ref familyDoc);
					double num19 = HSFamily.mmToFeet(num / 2.0 - num8 - num6 / 2.0);
					curveArray.Clear();
					curveArray.Append(Line.CreateBound(new XYZ(num11, 0.0, HSFamily.mmToFeet(num9 - num2 - 2.0 * num7)), new XYZ(num11, 0.0, num18)));
					bool flag9 = curHSType.m_eLinkType == HSLinkType.kLinkDH;
					if (flag9)
					{
						curveArray.Append(Line.CreateBound(new XYZ(num19, 0.0, HSFamily.mmToFeet(num9 - num2 - 2.0 * num7)), new XYZ(num11, 0.0, HSFamily.mmToFeet(num9 - num2 - 2.0 * num7))));
					}
					else
					{
						this.CreateSolid(curveArray, sketchPlane, familySymbolProfile, ref familyDoc, true);
						curveArray.Clear();
					}
					curveArray.Append(Line.CreateBound(new XYZ(num19, 0.0, num18), new XYZ(num19, 0.0, HSFamily.mmToFeet(num9 - num2 - 2.0 * num7))));
					this.CreateSolid(curveArray, sketchPlane, familySymbolProfile, ref familyDoc, true);
					bool flag10 = curHSType.m_eLinkType == HSLinkType.kLinkCG;
					if (flag10)
					{
						curveArray.Clear();
						double num20 = HSFamily.mmToFeet(num6 / 2.0);
						curveArray.Append(Line.CreateBound(new XYZ(num19 + num20, 0.0, HSFamily.mmToFeet(num9 - num2 - 1.5 * num7)), new XYZ(num11 - num20, 0.0, HSFamily.mmToFeet(num9 - num2 - 1.5 * num7))));
						this.CreateSolid(curveArray, sketchPlane, familySymbolProfile2, ref familyDoc, true);
					}
					else
					{
						bool flag11 = curHSType.m_eLinkType == HSLinkType.kLinkBH;
						if (flag11)
						{
							curveArray.Clear();
							double num21 = HSFamily.mmToFeet(num6 / 2.0);
							double num22 = HSFamily.mmToFeet(this.dHorB);
							curveArray.Append(Line.CreateBound(new XYZ(num11, -num22, HSFamily.mmToFeet(num9 - num2 - 1.5 * num7)), new XYZ(num19 - num21, -num22, HSFamily.mmToFeet(num9 - num2 - 1.5 * num7))));
							this.CreateSolid(curveArray, sketchPlane2, familySymbolProfile2, ref familyDoc, true);
						}
					}
				}
				this.CreateHSFamilyLabel(-num / 2.0, num / 2.0, ref familyDoc);
				result = true;
			}
			return result;
		}

		private bool CreateHSFamilyElementsDJ_GJ(HSDefineInfo curHSType, ref Autodesk.Revit.DB.Document familyDoc)
		{
			string strCode = curHSType.m_matVer.m_strCode;
			string strCode2 = curHSType.m_matHor.m_strCode;
			double num = 1000.0;
			double num2 = 300.0;
			double num3 = 400.0;
			double num4 = this.dHorH;
			double num5 = -3000.0;
			double dVal = -num5;
			FamilySymbol familySymbol = this.CreateSectionSymbol(curHSType.m_matVer.m_strCode, ref familyDoc, 1);
			FamilySymbol familySymbol2 = this.CreateSectionSymbol(curHSType.m_matHor.m_strCode, ref familyDoc, 0);
			bool flag = familySymbol == null || familySymbol2 == null;
			bool result;
			if (flag)
			{
				result = false;
			}
			else
			{
				FamilySymbolProfile familySymbolProfile = this.m_revit.Create.NewFamilySymbolProfile(familySymbol);
				FamilySymbolProfile familySymbolProfile2 = this.m_revit.Create.NewFamilySymbolProfile(familySymbol2);
				this.AddReferencePlaneX(num / 2.0, "Right", ref familyDoc);
				this.AddReferencePlaneX(-num / 2.0, "Left", ref familyDoc);
				this.AddReferencePlaneX(num / 2.0 + num2, "RightAdd", ref familyDoc);
				this.AddReferencePlaneX(-num / 2.0 - num2, "LeftAdd", ref familyDoc);
				this.AddReferencePlaneZ(num5, "Elevation", ref familyDoc);
				this.AddReferencePlaneZ(num5 - num4 / 2.0, "ElevationOffset", ref familyDoc);
				this.AddReferencePlaneZ(num5 - num4, "ElevationBottom", ref familyDoc);
				this.AddReferencePlaneZ(num5 - num3, "HighAdd", ref familyDoc);
				this.AddParameters("宽", num, ref familyDoc, true);
				this.AddParameters(HSFamily.m_strNetHigh, dVal, ref familyDoc, true);
				this.AddParameters("竖杆增加", num3, ref familyDoc, true);
				this.AddParameters("横担增加", num2, ref familyDoc, true);
				FamilyParameter familyParameter = this.AddParametersNoMainSize("VerTol", num5 - num3, ref familyDoc, true);
				FamilyParameter familyParameter2 = this.AddParametersNoMainSize("HorTol", num + num2 * 2.0, ref familyDoc, true);
				familyDoc.FamilyManager.SetFormula(familyParameter, HSFamily.m_strNetHigh + "+竖杆增加");
				familyDoc.FamilyManager.SetFormula(familyParameter2, "宽+横担增加*2");
				this.AddDimensionLevelUp("Elevation", HSFamily.m_strNetHigh, ref familyDoc);
				this.AddDimensionLevelUp("HighAdd", "VerTol", ref familyDoc);
				this.AddDimensionPlanAverage("Left", "Right", HSFamily.m_strLeftRightCenRefName, ref familyDoc);
				this.AddDimensionPlan("Left", "Right", "宽", ref familyDoc);
				this.AddDimensionPlanAverage("LeftAdd", "RightAdd", HSFamily.m_strLeftRightCenRefName, ref familyDoc);
				this.AddDimensionPlan("LeftAdd", "RightAdd", "HorTol", ref familyDoc);
				this.AddDimensionFore("Elevation", "ElevationBottom", "横担高h", ref familyDoc);
				this.AddDimensionForeAverage("Elevation", "ElevationBottom", "ElevationOffset", ref familyDoc);
				XYZ zero = XYZ.Zero;
				Plane plane = RevitVersionFuncs.CreatePlanByNormalAndOrigin(new XYZ(0.0, -1.0, 0.0), zero);
				CurveArray curveArray = new CurveArray();
				SketchPlane sketchPlane = SketchPlane.Create(familyDoc, plane);
				double num6 = HSFamily.mmToFeet(num + num2 * 2.0) / 2.0;
				familySymbolProfile2.Angle = -Math.PI*.5;
				double num7 = HSFamily.mmToFeet(num5 - num4 / 2.0);
				curveArray.Clear();
				curveArray.Append(Line.CreateBound(new XYZ(-num6, 0.0, num7), new XYZ(num6, 0.0, num7)));
				this.CreateSolid(curveArray, sketchPlane, familySymbolProfile2, ref familyDoc, true);
				Level level = this.FindElement(typeof(Level), HSFamily.m_strLevelUpRefName, ref familyDoc) as Level;
				double num8 = HSFamily.mmToFeet(num5 - num3);
				double elevation = level.Elevation;
				num6 = HSFamily.mmToFeet(num / 2.0);
				familySymbolProfile.Angle = -Math.PI*.5;
				curveArray.Clear();
				curveArray.Append(Line.CreateBound(new XYZ(-num6, 0.0, elevation), new XYZ(-num6, 0.0, num8)));
				this.CreateSolid(curveArray, sketchPlane, familySymbolProfile, ref familyDoc, true);
				curveArray.Clear();
				curveArray.Append(Line.CreateBound(new XYZ(num6, 0.0, num8), new XYZ(num6, 0.0, elevation)));
				this.CreateSolid(curveArray, sketchPlane, familySymbolProfile, ref familyDoc, true);
				Autodesk.Revit.DB.View view = this.FindElement(typeof(ViewPlan), HSFamily.m_strLevelRefName, ref familyDoc) as Autodesk.Revit.DB.View;
				familyDoc.FamilyCreate.NewControl((Autodesk.Revit.DB.ControlShape)3, view, zero + XYZ.BasisX * HSFamily.mmToFeet(200.0));
				familyDoc.FamilyCreate.NewControl((Autodesk.Revit.DB.ControlShape)2, view, zero);
				this.CreateHSLinkDevice(new XYZ(num6, 0.0, elevation), 2, HSFamily.m_strLevelUpRefName, ref familyDoc, "连接件1", true, HSLinkDevice.kLinkDeviceCircle, "Left", false);
				this.CreateHSLinkDevice(new XYZ(-num6, 0.0, elevation), 2, HSFamily.m_strLevelUpRefName, ref familyDoc, "连接件2", false, HSLinkDevice.kLinkDeviceCircle, "Left", false);
				this.CreateHSFamilyLabel(-num / 2.0 - num2, num / 2.0 + num2, ref familyDoc);
				result = true;
			}
			return result;
		}

		public FamilySymbol CreateSectionSymbol(string strSectionType, ref Autodesk.Revit.DB.Document familyDoc, int nSecPosType = 0)
		{
			string str = "横担";
			bool flag = nSecPosType == 1;
			if (flag)
			{
				str = "竖杆";
			}
			else
			{
				bool flag2 = nSecPosType == 2;
				if (flag2)
				{
					str = "斜杆";
				}
			}
			FamilyParameter familyParameter = this.AddParametersNoMainSize(str + "宽b", this.dHorB, ref familyDoc, true);
			FamilyParameter familyParameter2 = this.AddParametersNoMainSize(str + "高h", this.dHorH, ref familyDoc, true);
			FamilyParameter familyParameter3 = this.AddParametersNoMainSize(str + "厚t", this.dHorT, ref familyDoc, true);
			FamilyParameter familyParameter4 = this.AddParametersNoMainSize(str + "中m", this.dHorM, ref familyDoc, true);
			Family family = null;
			FamilySymbol familySymbol = null;
			this.CreateSectionFamily(strSectionType, false);
			this.LoadSectionFamily(ref family, ref familySymbol, nSecPosType, strSectionType, familyDoc);
			bool flag3 = family == null;
			FamilySymbol result;
			if (flag3)
			{
				result = null;
			}
			else
			{
				familyDoc.FamilyManager.AssociateElementParameterToFamilyParameter(familySymbol.GetParameter("Wide"), familyParameter);
				familyDoc.FamilyManager.AssociateElementParameterToFamilyParameter(familySymbol.GetParameter("High"), familyParameter2);
				familyDoc.FamilyManager.AssociateElementParameterToFamilyParameter(familySymbol.GetParameter("Thick"), familyParameter3);
				familyDoc.FamilyManager.AssociateElementParameterToFamilyParameter(familySymbol.GetParameter("ThickMid"), familyParameter4);
				result = familySymbol;
			}
			return result;
		}

		private bool CreateHSFamilyElementsDJ_SG(HSDefineInfo curHSType, ref Autodesk.Revit.DB.Document familyDoc)
		{
			string strCode = curHSType.m_matVer.m_strCode;
			string strCode2 = curHSType.m_matHor.m_strCode;
			double num = 1000.0;
			double num2 = 300.0;
			double num3 = 400.0;
			double num4 = 400.0;
			double num5 = -3000.0;
			double num6 = this.dHorH;
			FamilySymbol familySymbol = this.CreateSectionSymbol(curHSType.m_matHor.m_strCode, ref familyDoc, 0);
			FamilySymbol familySymbol2 = this.CreateSectionSymbol(curHSType.m_matVer.m_strCode, ref familyDoc, 1);
			bool flag = familySymbol2 == null || familySymbol == null;
			bool result;
			if (flag)
			{
				result = false;
			}
			else
			{
				FamilySymbolProfile familySymbolProfile = this.m_revit.Create.NewFamilySymbolProfile(familySymbol2);
				FamilySymbolProfile familySymbolProfile2 = this.m_revit.Create.NewFamilySymbolProfile(familySymbol);
				this.AddReferencePlaneX(num / 2.0, "Right", ref familyDoc);
				this.AddReferencePlaneX(-num / 2.0, "Left", ref familyDoc);
				this.AddReferencePlaneX(num / 2.0 - num4, "Offset", ref familyDoc);
				this.AddReferencePlaneX(num / 2.0 + num2, "RightAdd", ref familyDoc);
				this.AddReferencePlaneX(-num / 2.0 - num2, "LeftAdd", ref familyDoc);
				this.AddReferencePlaneZ(num5, "Elevation", ref familyDoc);
				this.AddReferencePlaneZ(num5 - num6 / 2.0, "ElevationOffset", ref familyDoc);
				this.AddReferencePlaneZ(num5 - num6, "ElevationBottom", ref familyDoc);
				this.AddReferencePlaneZ(num5 - num3, "HighAdd", ref familyDoc);
				this.AddParameters("宽", num, ref familyDoc, true);
				this.AddParameters(HSFamily.m_strNetHigh, -num5, ref familyDoc, true);
				this.AddParameters("竖杆增加", num3, ref familyDoc, true);
				this.AddParameters("横担增加", num2, ref familyDoc, true);
				this.AddParameters("偏心净宽", num4, ref familyDoc, true);
				FamilyParameter familyParameter = this.AddParametersNoMainSize("VerTol", -num5 + num3, ref familyDoc, true);
				FamilyParameter familyParameter2 = this.AddParametersNoMainSize("HorTol", num + num2 * 2.0, ref familyDoc, true);
				familyDoc.FamilyManager.SetFormula(familyParameter, HSFamily.m_strNetHigh + "+竖杆增加");
				familyDoc.FamilyManager.SetFormula(familyParameter2, "宽+横担增加*2");
				this.AddDimensionLevelUp("Elevation", HSFamily.m_strNetHigh, ref familyDoc);
				this.AddDimensionLevelUp("HighAdd", "VerTol", ref familyDoc);
				this.AddDimensionPlanAverage("Left", "Right", HSFamily.m_strLeftRightCenRefName, ref familyDoc);
				this.AddDimensionPlan("Left", "Right", "宽", ref familyDoc);
				this.AddDimensionPlanAverage("LeftAdd", "RightAdd", HSFamily.m_strLeftRightCenRefName, ref familyDoc);
				this.AddDimensionPlan("LeftAdd", "RightAdd", "HorTol", ref familyDoc);
				this.AddDimensionPlan("Right", "Offset", "偏心净宽", ref familyDoc);
				this.AddDimensionFore("Elevation", "ElevationBottom", "横担高h", ref familyDoc);
				this.AddDimensionForeAverage("Elevation", "ElevationBottom", "ElevationOffset", ref familyDoc);
				XYZ zero = XYZ.Zero;
				Plane plane = RevitVersionFuncs.CreatePlanByNormalAndOrigin(new XYZ(0.0, -1.0, 0.0), zero);
				CurveArray curveArray = new CurveArray();
				SketchPlane sketchPlane = SketchPlane.Create(familyDoc, plane);
				double num7 = HSFamily.mmToFeet(num + num2 * 2.0) / 2.0;
				familySymbolProfile2.Angle = -Math.PI*.5;
				double num8 = HSFamily.mmToFeet(num5 - num6 / 2.0);
				curveArray.Clear();
				curveArray.Append(Line.CreateBound(new XYZ(-num7, 0.0, num8), new XYZ(num7, 0.0, num8)));
				this.CreateSolid(curveArray, sketchPlane, familySymbolProfile2, ref familyDoc, true);
				Level level = this.FindElement(typeof(Level), HSFamily.m_strLevelUpRefName, ref familyDoc) as Level;
				double num9 = HSFamily.mmToFeet(num5 - num3);
				double elevation = level.Elevation;
				num7 = HSFamily.mmToFeet(num / 2.0);
				familySymbolProfile.Angle = -Math.PI*.5;
				curveArray.Clear();
				curveArray.Append(Line.CreateBound(new XYZ(-num7, 0.0, elevation), new XYZ(-num7, 0.0, num9)));
				this.CreateSolid(curveArray, sketchPlane, familySymbolProfile, ref familyDoc, true);
				curveArray.Clear();
				curveArray.Append(Line.CreateBound(new XYZ(num7, 0.0, num9), new XYZ(num7, 0.0, elevation)));
				this.CreateSolid(curveArray, sketchPlane, familySymbolProfile, ref familyDoc, true);
				double num10 = HSFamily.mmToFeet(num4);
				curveArray.Clear();
				curveArray.Append(Line.CreateBound(new XYZ(num7 - num10, 0.0, num9), new XYZ(num7 - num10, 0.0, elevation)));
				this.CreateSolid(curveArray, sketchPlane, familySymbolProfile, ref familyDoc, true);
				Autodesk.Revit.DB.View view = this.FindElement(typeof(ViewPlan), HSFamily.m_strLevelRefName, ref familyDoc) as Autodesk.Revit.DB.View;
				familyDoc.FamilyCreate.NewControl((Autodesk.Revit.DB.ControlShape)3, view, zero + XYZ.BasisX * HSFamily.mmToFeet(200.0));
				familyDoc.FamilyCreate.NewControl((Autodesk.Revit.DB.ControlShape)2, view, zero);
				this.CreateHSLinkDevice(new XYZ(num7, 0.0, elevation), 2, HSFamily.m_strLevelUpRefName, ref familyDoc, "连接件1", true, HSLinkDevice.kLinkDeviceCircle, "Left", false);
				this.CreateHSLinkDevice(new XYZ(-num7, 0.0, elevation), 2, HSFamily.m_strLevelUpRefName, ref familyDoc, "连接件2", false, HSLinkDevice.kLinkDeviceCircle, "Left", false);
				this.CreateHSLinkDevice(new XYZ(num7 - num10, 0.0, elevation), 2, HSFamily.m_strLevelUpRefName, ref familyDoc, "连接件3", false, HSLinkDevice.kLinkDeviceCircle, "Left", false);
				this.CreateHSFamilyLabel(-num / 2.0 - num2, num / 2.0 + num2, ref familyDoc);
				result = true;
			}
			return result;
		}

		private bool CreateHSFamilyElementsDJ_SL(HSDefineInfo curHSType, ref Autodesk.Revit.DB.Document familyDoc)
		{
			string strCode = curHSType.m_matVer.m_strCode;
			string strCode2 = curHSType.m_matHor.m_strCode;
			double num = 1500.0;
			double num2 = 400.0;
			double num3 = -3000.0;
			double num4 = this.dHorH;
			double num5 = num4;
			FamilySymbol familySymbol = this.CreateSectionSymbol(curHSType.m_matVer.m_strCode, ref familyDoc, 1);
			FamilySymbol familySymbol2 = this.CreateSectionSymbol(curHSType.m_matHor.m_strCode, ref familyDoc, 0);
			bool flag = familySymbol == null || familySymbol2 == null;
			bool result;
			if (flag)
			{
				result = false;
			}
			else
			{
				this.AddReferencePlaneX(num / 2.0, "Right", ref familyDoc);
				this.AddReferencePlaneX(-num / 2.0, "Left", ref familyDoc);
				this.AddReferencePlaneX(num / 2.0 + num5 / 2.0, "RightCenter", ref familyDoc);
				this.AddReferencePlaneX(num / 2.0 + num5, "RightCenterRight", ref familyDoc);
				this.AddReferencePlaneX(-num / 2.0 - num5 / 2.0, "LeftCenter", ref familyDoc);
				this.AddReferencePlaneX(-num / 2.0 - num5, "LeftCenterLeft", ref familyDoc);
				this.AddReferencePlaneX(num / 2.0 - num2 - num5 / 2.0, "Offset", ref familyDoc);
				this.AddReferencePlaneZ(num3, "Elevation", ref familyDoc);
				this.AddReferencePlaneZ(num3 - num4 / 2.0, "ElevationOffset", ref familyDoc);
				this.AddReferencePlaneZ(num3 - num4, "ElevationBottom", ref familyDoc);
				this.AddParameters("宽", num, ref familyDoc, true);
				this.AddParameters(HSFamily.m_strNetHigh, -num3, ref familyDoc, true);
				this.AddParameters("偏心净宽", num2, ref familyDoc, true);
				this.AddDimensionLevel("Elevation", HSFamily.m_strNetHigh, ref familyDoc);
				this.AddDimensionPlanAverage("Left", "Right", HSFamily.m_strLeftRightCenRefName, ref familyDoc);
				this.AddDimensionPlan("Left", "Right", "宽", ref familyDoc);
				FamilyParameter familyParameter = this.AddParametersNoMainSize("PXOffsetPar", num2 + num5 / 2.0, ref familyDoc, true);
				familyDoc.FamilyManager.SetFormula(familyParameter, "偏心净宽+竖杆高h/2");
				this.AddDimensionPlan("Right", "Offset", "PXOffsetPar", ref familyDoc);
				this.AddDimensionFore("Elevation", "ElevationBottom", "横担高h", ref familyDoc);
				this.AddDimensionForeAverage("Elevation", "ElevationBottom", "ElevationOffset", ref familyDoc);
				this.AddDimensionPlan("Left", "LeftCenterLeft", "竖杆高h", ref familyDoc);
				this.AddDimensionPlanAverage("Left", "LeftCenterLeft", "LeftCenter", ref familyDoc);
				this.AddDimensionPlan("Right", "RightCenterRight", "竖杆高h", ref familyDoc);
				this.AddDimensionPlanAverage("Right", "RightCenterRight", "RightCenter", ref familyDoc);
				ReferencePlane referencePlane = this.AddReferencePlaneY(-this.dHorB, "BHOffset", ref familyDoc);
				FamilyParameter familyParameter2 = this.AddParametersNoMainSize("BHOffsetPar", this.dHorB, ref familyDoc, true);
				familyDoc.FamilyManager.SetFormula(familyParameter2, "横担宽b/2+竖杆宽b/2");
				this.AddDimensionPlan(HSFamily.m_strForeBackCenRefName, "BHOffset", "BHOffsetPar", ref familyDoc);
				XYZ zero = XYZ.Zero;
				Plane plane = RevitVersionFuncs.CreatePlanByNormalAndOrigin(new XYZ(0.0, -1.0, 0.0), zero);
				CurveArray curveArray = new CurveArray();
				SketchPlane sketchPlane = SketchPlane.Create(familyDoc, plane);
				FamilySymbolProfile familySymbolProfile = this.m_revit.Create.NewFamilySymbolProfile(familySymbol);
				FamilySymbolProfile familySymbolProfile2 = this.m_revit.Create.NewFamilySymbolProfile(familySymbol2);
				Level level = this.FindElement(typeof(Level), HSFamily.m_strLevelUpRefName, ref familyDoc) as Level;
				double elevation = level.Elevation;
				familySymbolProfile2.Angle = -Math.PI*.5;
				familySymbolProfile.Angle = -Math.PI*.5;
				double num6 = HSFamily.mmToFeet(num) / 2.0;
				double num7 = HSFamily.mmToFeet(num2 + num4 / 2.0);
				double num8 = HSFamily.mmToFeet(num4) / 2.0;
				bool flag2 = curHSType.m_eLinkType != HSLinkType.kLinkDH;
				if (flag2)
				{
					double num9 = HSFamily.mmToFeet(num3 - num4 / 2.0);
					double num10 = HSFamily.mmToFeet(num3 - num4);
					bool flag3 = curHSType.m_eLinkType == HSLinkType.kLinkCG;
					if (flag3)
					{
						curveArray.Clear();
						curveArray.Append(Line.CreateBound(new XYZ(-num6, 0.0, num9), new XYZ(num6, 0.0, num9)));
						this.CreateSolid(curveArray, sketchPlane, familySymbolProfile2, ref familyDoc, true);
						curveArray.Clear();
						curveArray.Append(Line.CreateBound(new XYZ(num6 - num7, 0.0, HSFamily.mmToFeet(num3)), new XYZ(num6 - num7, 0.0, elevation)));
						this.CreateSolid(curveArray, sketchPlane, familySymbolProfile, ref familyDoc, true);
					}
					else
					{
						bool flag4 = curHSType.m_eLinkType == HSLinkType.kLinkBH;
						if (flag4)
						{
							double num11 = HSFamily.mmToFeet(this.dHorB);
							SketchPlane sketchPlane2 = SketchPlane.Create(familyDoc, referencePlane.Id);
							curveArray.Clear();
							curveArray.Append(Line.CreateBound(new XYZ(num6 + HSFamily.mmToFeet(num5), -num11, num9), new XYZ(-num6 - HSFamily.mmToFeet(num5), -num11, num9)));
							this.CreateSolid(curveArray, sketchPlane2, familySymbolProfile2, ref familyDoc, true);
							curveArray.Clear();
							curveArray.Append(Line.CreateBound(new XYZ(num6 - num7, 0.0, num10), new XYZ(num6 - num7, 0.0, elevation)));
							this.CreateSolid(curveArray, sketchPlane, familySymbolProfile, ref familyDoc, true);
						}
					}
					curveArray.Clear();
					curveArray.Append(Line.CreateBound(new XYZ(-num6 - num8, 0.0, elevation), new XYZ(-num6 - num8, 0.0, num10)));
					this.CreateSolid(curveArray, sketchPlane, familySymbolProfile, ref familyDoc, true);
					curveArray.Clear();
					curveArray.Append(Line.CreateBound(new XYZ(num6 + num8, 0.0, num10), new XYZ(num6 + num8, 0.0, elevation)));
					this.CreateSolid(curveArray, sketchPlane, familySymbolProfile, ref familyDoc, true);
				}
				else
				{
					double num12 = HSFamily.mmToFeet(num5 / 2.0);
					double num13 = HSFamily.mmToFeet(num3 - num4 / 2.0);
					curveArray.Clear();
					double num14 = num6 + num12;
					curveArray.Append(Line.CreateBound(new XYZ(-num14, 0.0, elevation), new XYZ(-num14, 0.0, num13)));
					curveArray.Append(Line.CreateBound(new XYZ(num14, 0.0, num13), new XYZ(num14, 0.0, elevation)));
					curveArray.Append(Line.CreateBound(new XYZ(num14, 0.0, num13), new XYZ(-num14, 0.0, num13)));
					this.CreateSolid(curveArray, sketchPlane, familySymbolProfile, ref familyDoc, true);
					curveArray.Clear();
					curveArray.Append(Line.CreateBound(new XYZ(num6 - num7, 0.0, HSFamily.mmToFeet(num3)), new XYZ(num6 - num7, 0.0, elevation)));
					this.CreateSolid(curveArray, sketchPlane, familySymbolProfile, ref familyDoc, true);
				}
				Autodesk.Revit.DB.View view = this.FindElement(typeof(ViewPlan), HSFamily.m_strLevelRefName, ref familyDoc) as Autodesk.Revit.DB.View;
				familyDoc.FamilyCreate.NewControl((Autodesk.Revit.DB.ControlShape)3, view, zero + XYZ.BasisX * HSFamily.mmToFeet(200.0));
				familyDoc.FamilyCreate.NewControl((Autodesk.Revit.DB.ControlShape)2, view, zero);
				this.CreateHSLinkDevice(new XYZ(num6 + num8, 0.0, elevation), 2, HSFamily.m_strLevelUpRefName, ref familyDoc, "连接件1", true, HSLinkDevice.kLinkDeviceCircle, "Left", false);
				this.CreateHSLinkDevice(new XYZ(-num6 - num8, 0.0, elevation), 2, HSFamily.m_strLevelUpRefName, ref familyDoc, "连接件2", false, HSLinkDevice.kLinkDeviceCircle, "Left", false);
				this.CreateHSLinkDevice(new XYZ(num6 - num7, 0.0, elevation), 2, HSFamily.m_strLevelUpRefName, ref familyDoc, "连接件3", false, HSLinkDevice.kLinkDeviceCircle, "Left", false);
				this.CreateHSFamilyLabel(-num / 2.0, num / 2.0, ref familyDoc);
				result = true;
			}
			return result;
		}

		private bool CreateHSFamilyElementsDJ_YC(HSDefineInfo curHSType, ref Autodesk.Revit.DB.Document familyDoc)
		{
			string strCode = curHSType.m_matVer.m_strCode;
			string strCode2 = curHSType.m_matHor.m_strCode;
			double num = 1000.0;
			double num2 = this.dHorH;
			double num3 = num2;
			double num4 = 100.0;
			double num5 = 100.0;
			double num6 = 500.0;
			int nFloorNum = curHSType.m_nFloorNum;
			bool flag = curHSType.m_nFloorNum > 5;
			if (flag)
			{
				num6 = 100.0;
			}
			double num7 = 1000.0;
			double num8 = -num7;
			num8 -= (double)(nFloorNum - 1) * (num2 + num6);
			FamilySymbol familySymbol = this.CreateSectionSymbol(curHSType.m_matVer.m_strCode, ref familyDoc, 1);
			FamilySymbol familySymbol2 = this.CreateSectionSymbol(curHSType.m_matHor.m_strCode, ref familyDoc, 0);
			bool flag2 = familySymbol == null || familySymbol2 == null;
			bool result;
			if (flag2)
			{
				result = false;
			}
			else
			{
				FamilySymbolProfile familySymbolProfile = this.m_revit.Create.NewFamilySymbolProfile(familySymbol);
				FamilySymbolProfile familySymbolProfile2 = this.m_revit.Create.NewFamilySymbolProfile(familySymbol2);
				familySymbolProfile2.Angle = -Math.PI*.5;
				familySymbolProfile.Angle = -Math.PI*.5;
				this.AddReferencePlaneX(num / 2.0, "Right", ref familyDoc);
				this.AddReferencePlaneX(-num / 2.0, "Left", ref familyDoc);
				this.AddReferencePlaneX(num / 2.0 + num3 / 2.0, "RightCenter", ref familyDoc);
				this.AddReferencePlaneX(-num / 2.0 - num3 / 2.0, "LeftCenter", ref familyDoc);
				this.AddReferencePlaneX(num / 2.0 + num3, "RightCenterRight", ref familyDoc);
				this.AddReferencePlaneX(-num / 2.0 - num3, "LeftCenterLeft", ref familyDoc);
				this.AddReferencePlaneZ(num8, "Elevation", ref familyDoc);
				this.AddReferencePlaneZ(num8 - num2 / 2.0, "ElevationOffset", ref familyDoc);
				this.AddReferencePlaneZ(num8 - num2, "ElevationBottom", ref familyDoc);
				this.AddParameters("宽", num, ref familyDoc, true);
				this.AddParameters(HSFamily.m_strOffsetHigh, num7, ref familyDoc, true);
				this.AddDimensionPlanAverage("Left", "Right", HSFamily.m_strLeftRightCenRefName, ref familyDoc);
				this.AddDimensionPlan("Left", "Right", "宽", ref familyDoc);
				this.AddDimensionFore("Elevation", "ElevationBottom", "横担高h", ref familyDoc);
				this.AddDimensionForeAverage("Elevation", "ElevationBottom", "ElevationOffset", ref familyDoc);
				this.AddDimensionPlan("Left", "LeftCenterLeft", "竖杆高h", ref familyDoc);
				this.AddDimensionPlanAverage("Left", "LeftCenterLeft", "LeftCenter", ref familyDoc);
				this.AddDimensionPlan("Right", "RightCenterRight", "竖杆高h", ref familyDoc);
				this.AddDimensionPlanAverage("Right", "RightCenterRight", "RightCenter", ref familyDoc);
				this.AddReferencePlaneX(num / 2.0 + num3 / 2.0 + num4, "OffsetRight", ref familyDoc);
				this.AddReferencePlaneX(-num / 2.0 - num3 / 2.0 - num4, "OffsetLeft", ref familyDoc);
				this.AddParameters("横担增加", num4, ref familyDoc, true);
				this.AddParameters("竖杆增加", num5, ref familyDoc, true);
				FamilyParameter familyParameter = this.AddParametersNoMainSize("OffsetXTol", num3 / 2.0 + num4, ref familyDoc, true);
				familyDoc.FamilyManager.SetFormula(familyParameter, "竖杆高h/2+横担增加");
				this.AddDimensionPlan("LeftCenter", "OffsetLeft", "OffsetXTol", ref familyDoc);
				this.AddDimensionPlan("RightCenter", "OffsetRight", "OffsetXTol", ref familyDoc);
				this.AddReferencePlaneZ(num8 - num2 - num5, "OffsetY", ref familyDoc);
				FamilyParameter familyParameter2 = this.AddParametersNoMainSize("OffsetYTol", num2 + num5, ref familyDoc, true);
				familyDoc.FamilyManager.SetFormula(familyParameter2, "横担高h/2+竖杆增加");
				this.AddDimensionFore("ElevationOffset", "OffsetY", "OffsetYTol", ref familyDoc);
				ReferencePlane referencePlane = this.AddReferencePlaneY(-this.dHorB, "BHOffset", ref familyDoc);
				FamilyParameter familyParameter3 = this.AddParametersNoMainSize("BHOffsetPar", this.dHorB, ref familyDoc, true);
				familyDoc.FamilyManager.SetFormula(familyParameter3, "横担宽b/2+竖杆宽b/2");
				this.AddDimensionPlan(HSFamily.m_strForeBackCenRefName, "BHOffset", "BHOffsetPar", ref familyDoc);
				string strRefPlanName = "Elevation";
				for (int i = 1; i < nFloorNum; i++)
				{
					double num9 = num8 - num2 / 2.0 + (num6 + num2) * (double)i;
					string text = "ElevationUp" + i.ToString();
					string text2 = "Elevation" + i.ToString();
					string text3 = "ElevationDown" + i.ToString();
					this.AddReferencePlaneZ(num9, text2, ref familyDoc);
					this.AddReferencePlaneZ(num9 + num2 / 2.0, text, ref familyDoc);
					this.AddReferencePlaneZ(num9 - num2 / 2.0, text3, ref familyDoc);
					string text4 = "净高" + i.ToString();
					this.AddParameters(text4, num6, ref familyDoc, true);
					this.AddDimensionForeAverage(text, text3, text2, ref familyDoc);
					this.AddDimensionFore(text, text3, "横担高h", ref familyDoc);
					this.AddDimensionFore(text3, strRefPlanName, text4, ref familyDoc);
					strRefPlanName = text;
				}
				this.AddParameters(HSFamily.m_strOffsetHigh, num7, ref familyDoc, true);
				FamilyParameter familyParameter4 = this.AddParametersNoMainSize("OffsetBaseHigh", this.dHorH + num7, ref familyDoc, true);
				familyDoc.FamilyManager.SetFormula(familyParameter4, "横担高h + " + HSFamily.m_strOffsetHigh);
				bool flag3 = nFloorNum > 1;
				if (flag3)
				{
					this.AddDimensionLevelUp("ElevationDown" + (nFloorNum - 1).ToString(), "OffsetBaseHigh", ref familyDoc);
				}
				else
				{
					this.AddDimensionLevelUp("ElevationBottom", "OffsetBaseHigh", ref familyDoc);
				}
				Level level = this.FindElement(typeof(Level), HSFamily.m_strLevelUpRefName, ref familyDoc) as Level;
				double elevation = level.Elevation;
				double num10 = HSFamily.mmToFeet(num) / 2.0;
				double num11 = HSFamily.mmToFeet(num2) / 2.0;
				double num12 = HSFamily.mmToFeet(num3) / 2.0;
				double num13 = HSFamily.mmToFeet(num4);
				double num14 = HSFamily.mmToFeet(num5);
				double num15 = HSFamily.mmToFeet(num8 - num2 - num5);
				double num16 = HSFamily.mmToFeet(this.dHorB);
				XYZ zero = XYZ.Zero;
				Plane plane = RevitVersionFuncs.CreatePlanByNormalAndOrigin(new XYZ(0.0, -1.0, 0.0), zero);
				CurveArray curveArray = new CurveArray();
				SketchPlane sketchPlane = SketchPlane.Create(familyDoc, plane);
				curveArray.Clear();
				curveArray.Append(Line.CreateBound(new XYZ(-num10 - num12, 0.0, elevation), new XYZ(-num10 - num12, 0.0, num15)));
				this.CreateSolid(curveArray, sketchPlane, familySymbolProfile, ref familyDoc, true);
				curveArray.Clear();
				curveArray.Append(Line.CreateBound(new XYZ(num10 + num12, 0.0, num15), new XYZ(num10 + num12, 0.0, elevation)));
				this.CreateSolid(curveArray, sketchPlane, familySymbolProfile, ref familyDoc, true);
				SketchPlane sketchPlane2 = SketchPlane.Create(familyDoc, referencePlane.Id);
				for (int j = 0; j < nFloorNum; j++)
				{
					double num17 = HSFamily.mmToFeet(num8 - num2 / 2.0 + (double)j * (num6 + num2));
					curveArray.Clear();
					curveArray.Append(Line.CreateBound(new XYZ(num10 + num12 * 2.0 + num13, -num16, num17), new XYZ(-num10 - num12 * 2.0 - num13, -num16, num17)));
					this.CreateSolid(curveArray, sketchPlane2, familySymbolProfile2, ref familyDoc, true);
				}
				Autodesk.Revit.DB.View view = this.FindElement(typeof(ViewPlan), HSFamily.m_strLevelRefName, ref familyDoc) as Autodesk.Revit.DB.View;
				familyDoc.FamilyCreate.NewControl((Autodesk.Revit.DB.ControlShape)3, view, zero + XYZ.BasisX * HSFamily.mmToFeet(200.0));
				familyDoc.FamilyCreate.NewControl((Autodesk.Revit.DB.ControlShape)2, view, zero);
				this.CreateHSLinkDevice(new XYZ(num10 + num11, 0.0, elevation), 2, HSFamily.m_strLevelUpRefName, ref familyDoc, "连接件1", true, HSLinkDevice.kLinkDeviceCircle, "Left", false);
				this.CreateHSLinkDevice(new XYZ(-num10 - num11, 0.0, elevation), 2, HSFamily.m_strLevelUpRefName, ref familyDoc, "连接件2", false, HSLinkDevice.kLinkDeviceCircle, "Left", false);
				this.CreateHSFamilyLabel(-num / 2.0, num / 2.0, ref familyDoc);
				result = true;
			}
			return result;
		}

		private bool CreateHSFamilyElementsDJ_ZJ(HSDefineInfo curHSType, ref Autodesk.Revit.DB.Document familyDoc)
		{
			string strCode = curHSType.m_matVer.m_strCode;
			string strCode2 = curHSType.m_matHor.m_strCode;
			double num = 1000.0;
			double mmVal = 400.0;
			double num2 = -3000.0;
			double num3 = this.dHorH;
			double num4 = num3;
			FamilySymbol familySymbol = this.CreateSectionSymbol(curHSType.m_matVer.m_strCode, ref familyDoc, 1);
			FamilySymbol familySymbol2 = this.CreateSectionSymbol(curHSType.m_matHor.m_strCode, ref familyDoc, 0);
			bool flag = familySymbol == null || familySymbol2 == null;
			bool result;
			if (flag)
			{
				result = false;
			}
			else
			{
				this.AddReferencePlaneX(num / 2.0, "Right", ref familyDoc);
				this.AddReferencePlaneX(-num / 2.0, "Left", ref familyDoc);
				this.AddReferencePlaneX(num / 2.0 + num4 / 2.0, "RightCenter", ref familyDoc);
				this.AddReferencePlaneX(num / 2.0 + num4, "RightCenterRight", ref familyDoc);
				this.AddReferencePlaneX(-num / 2.0 - num4 / 2.0, "LeftCenter", ref familyDoc);
				this.AddReferencePlaneX(-num / 2.0 - num4, "LeftCenterLeft", ref familyDoc);
				this.AddReferencePlaneZ(num2, "Elevation", ref familyDoc);
				this.AddReferencePlaneZ(num2 - num3 / 2.0, "ElevationOffset", ref familyDoc);
				this.AddReferencePlaneZ(num2 - num3, "ElevationBottom", ref familyDoc);
				this.AddParameters("宽", num, ref familyDoc, true);
				this.AddParameters(HSFamily.m_strNetHigh, -num2, ref familyDoc, true);
				this.AddDimensionLevel("Elevation", HSFamily.m_strNetHigh, ref familyDoc);
				this.AddDimensionPlanAverage("Left", "Right", HSFamily.m_strLeftRightCenRefName, ref familyDoc);
				this.AddDimensionPlan("Left", "Right", "宽", ref familyDoc);
				this.AddDimensionFore("Elevation", "ElevationBottom", "横担高h", ref familyDoc);
				this.AddDimensionForeAverage("Elevation", "ElevationBottom", "ElevationOffset", ref familyDoc);
				this.AddDimensionPlan("Left", "LeftCenterLeft", "竖杆高h", ref familyDoc);
				this.AddDimensionPlanAverage("Left", "LeftCenterLeft", "LeftCenter", ref familyDoc);
				this.AddDimensionPlan("Right", "RightCenterRight", "竖杆高h", ref familyDoc);
				this.AddDimensionPlanAverage("Right", "RightCenterRight", "RightCenter", ref familyDoc);
				ReferencePlane referencePlane = this.AddReferencePlaneY(-this.dHorB, "BHOffset", ref familyDoc);
				FamilyParameter familyParameter = this.AddParametersNoMainSize("BHOffsetPar", this.dHorB, ref familyDoc, true);
				familyDoc.FamilyManager.SetFormula(familyParameter, "横担宽b/2+竖杆宽b/2");
				this.AddDimensionPlan(HSFamily.m_strForeBackCenRefName, "BHOffset", "BHOffsetPar", ref familyDoc);
				XYZ zero = XYZ.Zero;
				Plane plane = RevitVersionFuncs.CreatePlanByNormalAndOrigin(new XYZ(0.0, -1.0, 0.0), zero);
				CurveArray curveArray = new CurveArray();
				SketchPlane sketchPlane = SketchPlane.Create(familyDoc, plane);
				FamilySymbolProfile familySymbolProfile = this.m_revit.Create.NewFamilySymbolProfile(familySymbol);
				FamilySymbolProfile familySymbolProfile2 = this.m_revit.Create.NewFamilySymbolProfile(familySymbol2);
				Level level = this.FindElement(typeof(Level), HSFamily.m_strLevelUpRefName, ref familyDoc) as Level;
				double elevation = level.Elevation;
				familySymbolProfile2.Angle = -Math.PI*.5;
				familySymbolProfile.Angle = -Math.PI*.5;
				double num5 = HSFamily.mmToFeet(num) / 2.0;
				double num6 = HSFamily.mmToFeet(mmVal);
				double num7 = HSFamily.mmToFeet(num3) / 2.0;
				double num8 = 0.0;
				bool flag2 = curHSType.m_eLinkType != HSLinkType.kLinkDH;
				if (flag2)
				{
					double num9 = HSFamily.mmToFeet(num2 - num3 / 2.0);
					double num10 = HSFamily.mmToFeet(num2 - num3);
					bool flag3 = curHSType.m_eLinkType == HSLinkType.kLinkCG;
					if (flag3)
					{
						curveArray.Clear();
						curveArray.Append(Line.CreateBound(new XYZ(-num5, 0.0, num9), new XYZ(num5, 0.0, num9)));
						this.CreateSolid(curveArray, sketchPlane, familySymbolProfile2, ref familyDoc, true);
					}
					else
					{
						bool flag4 = curHSType.m_eLinkType == HSLinkType.kLinkBH;
						if (flag4)
						{
							num8 = HSFamily.mmToFeet(this.dHorB);
							SketchPlane sketchPlane2 = SketchPlane.Create(familyDoc, referencePlane.Id);
							curveArray.Clear();
							curveArray.Append(Line.CreateBound(new XYZ(num5 + HSFamily.mmToFeet(num4), -num8, num9), new XYZ(-num5, -num8, num9)));
							this.CreateSolid(curveArray, sketchPlane2, familySymbolProfile2, ref familyDoc, true);
						}
					}
					curveArray.Clear();
					curveArray.Append(Line.CreateBound(new XYZ(num5 + num7, 0.0, num10), new XYZ(num5 + num7, 0.0, elevation)));
					this.CreateSolid(curveArray, sketchPlane, familySymbolProfile, ref familyDoc, true);
				}
				else
				{
					double num11 = HSFamily.mmToFeet(num4 / 2.0);
					double num12 = HSFamily.mmToFeet(num2 - num3 / 2.0);
					curveArray.Clear();
					double num13 = num5 + num11;
					curveArray.Append(Line.CreateBound(new XYZ(num13, 0.0, num12), new XYZ(num13, 0.0, elevation)));
					curveArray.Append(Line.CreateBound(new XYZ(num13, 0.0, num12), new XYZ(-num5, 0.0, num12)));
					this.CreateSolid(curveArray, sketchPlane, familySymbolProfile, ref familyDoc, true);
				}
				Autodesk.Revit.DB.View view = this.FindElement(typeof(ViewPlan), HSFamily.m_strLevelRefName, ref familyDoc) as Autodesk.Revit.DB.View;
				familyDoc.FamilyCreate.NewControl((Autodesk.Revit.DB.ControlShape)3, view, zero + XYZ.BasisX * HSFamily.mmToFeet(200.0));
				familyDoc.FamilyCreate.NewControl((Autodesk.Revit.DB.ControlShape)2, view, zero);
				string strRefPlanName = "BHOffset";
				bool flag5 = curHSType.m_eLinkType != HSLinkType.kLinkBH;
				if (flag5)
				{
					strRefPlanName = HSFamily.m_strForeBackCenRefName;
				}
				this.CreateHSLinkDevice(new XYZ(num5 + num7, 0.0, elevation), 2, HSFamily.m_strLevelUpRefName, ref familyDoc, "连接件2", true, HSLinkDevice.kLinkDeviceRect, "Left", false);
				this.CreateHSLinkDevice(new XYZ(-num5, -num8, HSFamily.mmToFeet(num2 - num3 / 2.0)), 0, strRefPlanName, ref familyDoc, "连接件1", true, HSLinkDevice.kLinkDeviceRect, "Left", false);
				this.CreateHSFamilyLabel(-num / 2.0, num / 2.0, ref familyDoc);
				result = true;
			}
			return result;
		}

		private bool CreateHSLinkDevice(XYZ ptBase, int nPosType, string strRefPlanName, ref Autodesk.Revit.DB.Document familyDoc, string strTypeName = "左固件", bool bCreateDimention = true, HSLinkDevice hsLinkType = HSLinkDevice.kLinkDeviceRect, string strLeftRightRefName = "Left", bool bTunnelExtendToTop = false)
		{
			double dVal = 300.0;
			double dVal2 = 500.0;
			double num = 10.0;
			this.AddParametersByGroup(strTypeName, (int)hsLinkType, ref familyDoc, (Autodesk.Revit.DB.BuiltInParameterGroup)(-5000101), true);
			FamilyParameter familyParameter = this.AddParametersByGroup(strTypeName + "RectVisible", true, ref familyDoc, (Autodesk.Revit.DB.BuiltInParameterGroup)(-5000104), true);
			familyDoc.FamilyManager.SetFormula(familyParameter, strTypeName + "=1");
			FamilyParameter familyParameter2 = this.AddParametersByGroup(strTypeName + "CircleVisible", true, ref familyDoc, (Autodesk.Revit.DB.BuiltInParameterGroup)(-5000104), true);
			familyDoc.FamilyManager.SetFormula(familyParameter2, strTypeName + "=2");
			XYZ xyz = XYZ.Zero;
			double num2 = HSFamily.mmToFeet(num);
			string text = "DeviceRef" + nPosType.ToString();
			XYZ xyz2 = XYZ.BasisX;
			switch (nPosType)
			{
			case 0:
			{
				xyz2 = -XYZ.BasisX;
				xyz = ptBase + xyz2 * num2;
				ReferencePlane referencePlane = this.AddReferencePlaneX(HSFamily.feetToMM(xyz.X), text, ref familyDoc);
				break;
			}
			case 1:
			{
				xyz2 = XYZ.BasisX;
				xyz = ptBase + xyz2 * num2;
				ReferencePlane referencePlane = this.AddReferencePlaneX(HSFamily.feetToMM(xyz.X), text, ref familyDoc);
				break;
			}
			case 2:
			{
				xyz2 = XYZ.BasisZ;
				xyz = ptBase + xyz2 * num2;
				ReferencePlane referencePlane = this.AddReferencePlaneZ(HSFamily.feetToMM(xyz.Z), text, ref familyDoc);
				break;
			}
			case 3:
			{
				xyz2 = -XYZ.BasisZ;
				xyz = ptBase + xyz2 * num2;
				ReferencePlane referencePlane = this.AddReferencePlaneZ(HSFamily.feetToMM(xyz.Z), text, ref familyDoc);
				break;
			}
			}
			foreach (string text2 in new List<string>
			{
				"Y",
				"Z"
			})
			{
				Family family = null;
				FamilySymbol familySymbol = null;
				this.CreateSectionFamily(text2, false);
				string sectionFamilyName = this.GetSectionFamilyName(text2);
				bool flag = !HSFamily.IsFamilyIsLoaded(ref family, sectionFamilyName, familyDoc);
				if (flag)
				{
					bool flag2 = !this.LoadFamily(ref family, sectionFamilyName, familyDoc);
					if (flag2)
					{
						return false;
					}
					FamilyParameter familyParameter3 = this.AddParametersNoMainSize("固件宽b", dVal, ref familyDoc, true);
					FamilyParameter familyParameter4 = this.AddParametersNoMainSize("固件高h", dVal2, ref familyDoc, true);
					FamilyParameter familyParameter5 = this.AddParametersNoMainSize("固件厚t", num, ref familyDoc, true);
					List<FamilySymbol> symbols = family.GetSymbols();
					foreach (FamilySymbol familySymbol2 in symbols)
					{
						FamilySymbol familySymbol3 = familySymbol2;
						bool flag3 = familySymbol3 == null;
						if (!flag3)
						{
							familyDoc.FamilyManager.AssociateElementParameterToFamilyParameter(familySymbol3.GetParameter("Wide"), familyParameter3);
							familyDoc.FamilyManager.AssociateElementParameterToFamilyParameter(familySymbol3.GetParameter("High"), familyParameter4);
						}
					}
				}
				this.LoadSectionFamily(ref family, ref familySymbol, 0, text2, familyDoc);
				bool flag4 = family == null;
				if (flag4)
				{
					return false;
				}
				XYZ origin = new XYZ(0.0, ptBase.Y, 0.0);
				Plane plane = RevitVersionFuncs.CreatePlanByNormalAndOrigin(new XYZ(0.0, -1.0, 0.0), origin);
				CurveArray curveArray = new CurveArray();
				SketchPlane sketchPlane = SketchPlane.Create(familyDoc, plane);
				ReferencePlane referencePlane2 = null;
				bool flag5 = this.IsReferencePlaneExist(ref referencePlane2, strRefPlanName, ref familyDoc) && referencePlane2 != null;
				if (flag5)
				{
					sketchPlane = SketchPlane.Create(familyDoc, referencePlane2.Id);
				}
				FamilySymbolProfile familySymbolProfile = this.m_revit.Create.NewFamilySymbolProfile(familySymbol);
				familySymbolProfile.Angle = -Math.PI*.5;
				curveArray.Clear();
				curveArray.Append(Line.CreateBound(ptBase, xyz));
				Sweep elem = null;
				bool flag6 = !this.CreateSolid(ref elem, curveArray, sketchPlane, familySymbolProfile, ref familyDoc, true);
				if (flag6)
				{
					return false;
				}
				bool flag7 = text2 == "Z";
				if (flag7)
				{
					familyDoc.FamilyManager.AssociateElementParameterToFamilyParameter(elem.GetParameter(Autodesk.Revit.DB.BuiltInParameter.IS_VISIBLE_PARAM), familyParameter);
				}
				else
				{
					familyDoc.FamilyManager.AssociateElementParameterToFamilyParameter(elem.GetParameter(Autodesk.Revit.DB.BuiltInParameter.IS_VISIBLE_PARAM), familyParameter2);
				}
			}
			if (bCreateDimention)
			{
				bool flag8 = nPosType == 2;
				if (flag8)
				{
					if (bTunnelExtendToTop)
					{
						this.AddDimensionTopR(text, "CompartmentTop", "固件厚t", ref familyDoc);
					}
					else
					{
						this.AddDimensionLevelUp(text, "固件厚t", ref familyDoc);
					}
				}
				else
				{
					bool flag9 = nPosType == 3;
					if (flag9)
					{
						this.AddDimensionLevel(text, "固件厚t", ref familyDoc);
					}
					else
					{
						this.AddDimensionPlan(text, strLeftRightRefName, "固件厚t", ref familyDoc);
					}
				}
			}
			return true;
		}

		private bool CreateHSLinkDeviceNew(XYZ ptBase, int nPosType, string strBaseRefPlanName, string strOnRefPlanName, ref Autodesk.Revit.DB.Document familyDoc, string strTypeName = "左固件", bool bCreateDimention = true, HSLinkDevice hsLinkType = HSLinkDevice.kLinkDeviceRect)
		{
			double dVal = 300.0;
			double dVal2 = 500.0;
			double num = 10.0;
			this.AddParametersByGroup(strTypeName, (int)hsLinkType, ref familyDoc, (Autodesk.Revit.DB.BuiltInParameterGroup)(-5000101), true);
			FamilyParameter familyParameter = this.AddParametersByGroup(strTypeName + "RectVisible", true, ref familyDoc, (Autodesk.Revit.DB.BuiltInParameterGroup)(-5000104), true);
			familyDoc.FamilyManager.SetFormula(familyParameter, strTypeName + "=1");
			FamilyParameter familyParameter2 = this.AddParametersByGroup(strTypeName + "CircleVisible", true, ref familyDoc, (Autodesk.Revit.DB.BuiltInParameterGroup)(-5000104), true);
			familyDoc.FamilyManager.SetFormula(familyParameter2, strTypeName + "=2");
			XYZ xyz = XYZ.Zero;
			double num2 = HSFamily.mmToFeet(num);
			string text = "DeviceRef" + nPosType.ToString();
			XYZ xyz2 = XYZ.BasisX;
			switch (nPosType)
			{
			case 0:
			{
				xyz2 = -XYZ.BasisX;
				xyz = ptBase + xyz2 * num2;
				ReferencePlane referencePlane = this.AddReferencePlaneX(HSFamily.feetToMM(xyz.X), text, ref familyDoc);
				break;
			}
			case 1:
			{
				xyz2 = XYZ.BasisX;
				xyz = ptBase + xyz2 * num2;
				ReferencePlane referencePlane = this.AddReferencePlaneX(HSFamily.feetToMM(xyz.X), text, ref familyDoc);
				break;
			}
			case 2:
			{
				xyz2 = XYZ.BasisZ;
				xyz = ptBase + xyz2 * num2;
				ReferencePlane referencePlane = this.AddReferencePlaneZ(HSFamily.feetToMM(xyz.Z), text, ref familyDoc);
				break;
			}
			case 3:
			{
				xyz2 = -XYZ.BasisZ;
				xyz = ptBase + xyz2 * num2;
				ReferencePlane referencePlane = this.AddReferencePlaneZ(HSFamily.feetToMM(xyz.Z), text, ref familyDoc);
				break;
			}
			}
			foreach (string text2 in new List<string>
			{
				"Y",
				"Z"
			})
			{
				Family family = null;
				FamilySymbol familySymbol = null;
				this.CreateSectionFamily(text2, false);
				string sectionFamilyName = this.GetSectionFamilyName(text2);
				bool flag = !HSFamily.IsFamilyIsLoaded(ref family, sectionFamilyName, familyDoc);
				if (flag)
				{
					bool flag2 = !this.LoadFamily(ref family, sectionFamilyName, familyDoc);
					if (flag2)
					{
						return false;
					}
					FamilyParameter familyParameter3 = this.AddParametersNoMainSize("固件宽b", dVal, ref familyDoc, true);
					FamilyParameter familyParameter4 = this.AddParametersNoMainSize("固件高h", dVal2, ref familyDoc, true);
					FamilyParameter familyParameter5 = this.AddParametersNoMainSize("固件厚t", num, ref familyDoc, true);
					List<FamilySymbol> symbols = family.GetSymbols();
					foreach (FamilySymbol familySymbol2 in symbols)
					{
						FamilySymbol familySymbol3 = familySymbol2;
						bool flag3 = familySymbol3 == null;
						if (!flag3)
						{
							familyDoc.FamilyManager.AssociateElementParameterToFamilyParameter(familySymbol3.GetParameter("Wide"), familyParameter3);
							familyDoc.FamilyManager.AssociateElementParameterToFamilyParameter(familySymbol3.GetParameter("High"), familyParameter4);
						}
					}
				}
				this.LoadSectionFamily(ref family, ref familySymbol, 0, text2, familyDoc);
				bool flag4 = family == null;
				if (flag4)
				{
					return false;
				}
				XYZ origin = new XYZ(0.0, ptBase.Y, 0.0);
				Plane plane = RevitVersionFuncs.CreatePlanByNormalAndOrigin(new XYZ(0.0, -1.0, 0.0), origin);
				CurveArray curveArray = new CurveArray();
				SketchPlane sketchPlane = SketchPlane.Create(familyDoc, plane);
				ReferencePlane referencePlane2 = null;
				bool flag5 = this.IsReferencePlaneExist(ref referencePlane2, strOnRefPlanName, ref familyDoc) && referencePlane2 != null;
				if (flag5)
				{
					sketchPlane = SketchPlane.Create(familyDoc, referencePlane2.Id);
				}
				FamilySymbolProfile familySymbolProfile = this.m_revit.Create.NewFamilySymbolProfile(familySymbol);
				familySymbolProfile.Angle = -Math.PI*.5;
				curveArray.Clear();
				curveArray.Append(Line.CreateBound(ptBase, xyz));
				Sweep elem = null;
				this.CreateSolid(ref elem, curveArray, sketchPlane, familySymbolProfile, ref familyDoc, true);
				bool flag6 = text2 == "Z";
				if (flag6)
				{
					familyDoc.FamilyManager.AssociateElementParameterToFamilyParameter(elem.GetParameter(Autodesk.Revit.DB.BuiltInParameter.IS_VISIBLE_PARAM), familyParameter);
				}
				else
				{
					familyDoc.FamilyManager.AssociateElementParameterToFamilyParameter(elem.GetParameter(Autodesk.Revit.DB.BuiltInParameter.IS_VISIBLE_PARAM), familyParameter2);
				}
			}
			if (bCreateDimention)
			{
				bool flag7 = nPosType == 2 || nPosType == 3;
				if (flag7)
				{
					this.AddDimensionFore(text, strBaseRefPlanName, "固件厚t", ref familyDoc);
				}
				else
				{
					this.AddDimensionPlan(text, strBaseRefPlanName, "固件厚t", ref familyDoc);
				}
			}
			return true;
		}

		private bool CreateHSFamilyElementsDJ_DB(HSDefineInfo curHSType, ref Autodesk.Revit.DB.Document familyDoc)
		{
			string strCode = curHSType.m_matVer.m_strCode;
			double num = 1000.0;
			double num2 = -3000.0;
			FamilySymbol familySymbol = this.CreateSectionSymbol(curHSType.m_matVer.m_strCode, ref familyDoc, 1);
			bool flag = familySymbol == null;
			bool result;
			if (flag)
			{
				result = false;
			}
			else
			{
				FamilySymbolProfile familySymbolProfile = this.m_revit.Create.NewFamilySymbolProfile(familySymbol);
				this.AddReferencePlaneX(num / 2.0, "Right", ref familyDoc);
				this.AddReferencePlaneX(-num / 2.0, "Left", ref familyDoc);
				this.AddReferencePlaneZ(num2, "Elevation", ref familyDoc);
				this.AddParameters(HSFamily.m_strNetHigh, -num2, ref familyDoc, true);
				this.AddDimensionLevelUp("Elevation", HSFamily.m_strNetHigh, ref familyDoc);
				XYZ zero = XYZ.Zero;
				Plane plane = RevitVersionFuncs.CreatePlanByNormalAndOrigin(new XYZ(0.0, -1.0, 0.0), zero);
				CurveArray curveArray = new CurveArray();
				SketchPlane sketchPlane = SketchPlane.Create(familyDoc, plane);
				Level level = this.FindElement(typeof(Level), HSFamily.m_strLevelUpRefName, ref familyDoc) as Level;
				double num3 = HSFamily.mmToFeet(num2);
				double elevation = level.Elevation;
				familySymbolProfile.Angle = -Math.PI*.5;
				curveArray.Clear();
				curveArray.Append(Line.CreateBound(new XYZ(0.0, 0.0, elevation), new XYZ(0.0, 0.0, num3)));
				this.CreateSolid(curveArray, sketchPlane, familySymbolProfile, ref familyDoc, true);
				Autodesk.Revit.DB.View view = this.FindElement(typeof(ViewPlan), HSFamily.m_strLevelRefName, ref familyDoc) as Autodesk.Revit.DB.View;
				familyDoc.FamilyCreate.NewControl((Autodesk.Revit.DB.ControlShape)3, view, zero + XYZ.BasisX * HSFamily.mmToFeet(200.0));
				familyDoc.FamilyCreate.NewControl((Autodesk.Revit.DB.ControlShape)2, view, zero);
				this.AddDimensionPlanAverage("Left", "Right", HSFamily.m_strLeftRightCenRefName, ref familyDoc);
				this.CreateHSLinkDevice(new XYZ(0.0, 0.0, elevation), 2, HSFamily.m_strLevelUpRefName, ref familyDoc, "连接件1", true, HSLinkDevice.kLinkDeviceRect, "Left", false);
				this.CreateHSFamilyLabel(0.0, this.dHorH * 2.0, ref familyDoc);
				result = true;
			}
			return result;
		}

		private bool CreateHSFamilyElementsDJ_DG(HSDefineInfo curHSType, ref Autodesk.Revit.DB.Document familyDoc)
		{
			double num = 500.0;
			double num2 = 20.0;
			double num3 = 15.0;
			double num4 = 50.0;
			double num5 = 1000.0;
			double num6 = num / 2.0;
			double num7 = -(num5 + num6 + num2 + num3);
			FamilySymbol familySymbol = this.CreateSectionSymbol(curHSType.m_matVer.m_strCode, ref familyDoc, 1);
			bool flag = familySymbol == null;
			bool result;
			if (flag)
			{
				result = false;
			}
			else
			{
				FamilySymbolProfile familySymbolProfile = this.m_revit.Create.NewFamilySymbolProfile(familySymbol);
				this.AddReferencePlaneX(num6 + num2, "Right", ref familyDoc);
				this.AddReferencePlaneX(-num6 - num2, "Left", ref familyDoc);
				this.AddReferencePlaneX(num6 + num2 + num3, "RightOut", ref familyDoc);
				this.AddReferencePlaneX(-num6 - num2 - num3, "LeftOut", ref familyDoc);
				this.AddReferencePlaneY(num4, "Fore", ref familyDoc);
				this.AddReferencePlaneY(-num4, "Back", ref familyDoc);
				this.AddReferencePlaneZ(num7, "Elevation", ref familyDoc);
				this.AddReferencePlaneZ(num7 + num6 + num3 + num2, "UpUpUp", ref familyDoc);
				this.AddReferencePlaneZ(num7 + num6 + num3, "UpUp", ref familyDoc);
				this.AddReferencePlaneZ(num7 + num6, "UpDown", ref familyDoc);
				this.AddReferencePlaneZ(num7 - num6, "DownUp", ref familyDoc);
				this.AddReferencePlaneZ(num7 - num6 - num3, "DownDown", ref familyDoc);
				this.AddReferencePlaneZ(num7 - num6 - num3 - num2, "DownDownDown", ref familyDoc);
				this.AddParameters(HSFamily.m_strNetHigh, num5, ref familyDoc, true);
				this.AddParameters("管径", num, ref familyDoc, true);
				this.AddParameters("管径偏移量", num3, ref familyDoc, true);
				FamilyParameter familyParameter = this.AddParameters("管箍厚度", num3, ref familyDoc, true);
				this.AddParameters("管箍长度", num4 * 2.0, ref familyDoc, true);
				FamilyParameter familyParameter2 = this.AddParametersNoMainSize("管心高度", -num7, ref familyDoc, true);
				familyDoc.FamilyManager.SetFormula(familyParameter2, "管径/2+管径偏移量+管箍厚度+" + HSFamily.m_strNetHigh);
				FamilyParameter familyParameter3 = this.AddParametersNoMainSize("管箍外径", (num6 + num3 + num2) * 2.0, ref familyDoc, true);
				familyDoc.FamilyManager.SetFormula(familyParameter3, "管径+2*(管径偏移量+管箍厚度)");
				this.AddDimensionPlanAverage("Left", "Right", HSFamily.m_strLeftRightCenRefName, ref familyDoc);
				this.AddDimensionPlanAverage("LeftOut", "RightOut", HSFamily.m_strLeftRightCenRefName, ref familyDoc);
				this.AddDimensionPlanAverage("Fore", "Back", HSFamily.m_strForeBackCenRefName, ref familyDoc);
				this.AddDimensionForeAverage("UpDown", "DownUp", "Elevation", ref familyDoc);
				this.AddDimensionForeAverage("UpUp", "DownDown", "Elevation", ref familyDoc);
				this.AddDimensionForeAverage("UpUpUp", "DownDownDown", "Elevation", ref familyDoc);
				this.AddDimensionLevel("UpUpUp", HSFamily.m_strNetHigh, ref familyDoc);
				this.AddDimensionFore("UpDown", "DownUp", "管径", ref familyDoc);
				this.AddDimensionFore("UpDown", "UpUp", "管径偏移量", ref familyDoc);
				this.AddDimensionFore("UpUp", "UpUpUp", "管箍厚度", ref familyDoc);
				this.AddDimensionPlan("Fore", "Back", "管箍长度", ref familyDoc);
				XYZ zero = XYZ.Zero;
				Plane plane = RevitVersionFuncs.CreatePlanByNormalAndOrigin(new XYZ(1.0, 0.0, 0.0), zero);
				CurveArray curveArray = new CurveArray();
				SketchPlane sketchPlane = SketchPlane.Create(familyDoc, plane);
				Level level = this.FindElement(typeof(Level), HSFamily.m_strLevelUpRefName, ref familyDoc) as Level;
				double num8 = HSFamily.mmToFeet(num7 + num6 + num3 + num2);
				double elevation = level.Elevation;
				familySymbolProfile.Angle = -Math.PI*.5;
				curveArray.Clear();
				curveArray.Append(Line.CreateBound(new XYZ(0.0, 0.0, elevation), new XYZ(0.0, 0.0, num8)));
				this.CreateSolid(curveArray, sketchPlane, familySymbolProfile, ref familyDoc, true);
				string text = "I";
				Family family = null;
				FamilySymbol familySymbol2 = null;
				this.CreateSectionFamily(text, false);
				this.LoadSectionFamily(ref family, ref familySymbol2, 0, text, familyDoc);
				bool flag2 = family == null;
				if (flag2)
				{
					result = false;
				}
				else
				{
					familyDoc.FamilyManager.AssociateElementParameterToFamilyParameter(familySymbol2.GetParameter("Wide"), familyParameter3);
					familyDoc.FamilyManager.AssociateElementParameterToFamilyParameter(familySymbol2.GetParameter("High"), familyParameter3);
					familyDoc.FamilyManager.AssociateElementParameterToFamilyParameter(familySymbol2.GetParameter("Thick"), familyParameter);
					familySymbolProfile = this.m_revit.Create.NewFamilySymbolProfile(familySymbol2);
					curveArray.Clear();
					curveArray.Append(Line.CreateBound(new XYZ(0.0, -HSFamily.mmToFeet(num4), HSFamily.mmToFeet(num7)), new XYZ(0.0, HSFamily.mmToFeet(num4), HSFamily.mmToFeet(num7))));
					this.CreateSolid(curveArray, sketchPlane, familySymbolProfile, ref familyDoc, true);
					Autodesk.Revit.DB.View view = this.FindElement(typeof(ViewPlan), HSFamily.m_strLevelRefName, ref familyDoc) as Autodesk.Revit.DB.View;
					familyDoc.FamilyCreate.NewControl((Autodesk.Revit.DB.ControlShape)3, view, zero + XYZ.BasisX * HSFamily.mmToFeet(200.0));
					familyDoc.FamilyCreate.NewControl((Autodesk.Revit.DB.ControlShape)2, view, zero);
					this.CreateHSLinkDevice(new XYZ(0.0, 0.0, elevation), 2, HSFamily.m_strLevelUpRefName, ref familyDoc, "连接件1", true, HSLinkDevice.kLinkDeviceCircle, "Left", false);
					this.CreateHSFamilyLabel(0.0, this.dHorH * 2.0, ref familyDoc);
					result = true;
				}
			}
			return result;
		}

		private bool CreateSolid(CurveArray curvsPath, SketchPlane sketchPlane, SweepProfile curProfile, ref Autodesk.Revit.DB.Document familyDoc, bool bIsSolid = true)
		{
			Sweep sweep = null;
			return this.CreateSolid(ref sweep, curvsPath, sketchPlane, curProfile, ref familyDoc, bIsSolid);
		}

		private bool CreateSolid(ref Sweep solid, CurveArray curvsPath, SketchPlane sketchPlane, SweepProfile curProfile, ref Autodesk.Revit.DB.Document familyDoc, bool bIsSolid = true)
		{
			bool flag = curvsPath.Size == 0;
			bool result;
			if (flag)
			{
				result = false;
			}
			else
			{
				solid = null;
				try
				{
					solid = familyDoc.FamilyCreate.NewSweep(bIsSolid, curvsPath, sketchPlane, curProfile, 0, 0);
				}
				catch (Exception ex)
				{
					Utils.MessageBox(ex.Message);
					return false;
				}
				FamilyParameter familyParameter = this.AddMaterialParameter(HSFamily.m_strMaterialCZ, ref familyDoc, true);
				bool flag2 = solid != null;
				if (flag2)
				{
					familyDoc.FamilyManager.AssociateElementParameterToFamilyParameter(solid.GetParameter(Autodesk.Revit.DB.BuiltInParameter.MATERIAL_ID_PARAM), familyParameter);
				}
				result = true;
			}
			return result;
		}

		private bool AddDimensionPlanAverage(string strRefPlanName1, string strRefPlanName2, string strRefPlanNameMid, ref Autodesk.Revit.DB.Document familyDoc)
		{
			Autodesk.Revit.DB.View pView = this.FindElement(typeof(ViewPlan), HSFamily.m_strLevelRefName, ref familyDoc) as Autodesk.Revit.DB.View;
			return this.AddDimensionAverage(pView, strRefPlanName1, strRefPlanName2, strRefPlanNameMid, ref familyDoc);
		}

		private bool AddDimensionPlan(string strRefPlanName1, string strRefPlanName2, string strParameterName, ref Autodesk.Revit.DB.Document familyDoc)
		{
			Autodesk.Revit.DB.View pView = this.FindElement(typeof(ViewPlan), HSFamily.m_strLevelRefName, ref familyDoc) as Autodesk.Revit.DB.View;
			return this.AddDimension(pView, strRefPlanName1, strRefPlanName2, strParameterName, ref familyDoc);
		}

		private bool AddDimensionSectionPlanAverage(string strRefPlanName1, string strRefPlanName2, string strRefPlanNameMid, ref Autodesk.Revit.DB.Document familyDoc)
		{
			Autodesk.Revit.DB.View pView = this.FindElement(typeof(ViewPlan), HSFamily.m_strLevelSectionRefName, ref familyDoc) as Autodesk.Revit.DB.View;
			return this.AddDimensionAverage(pView, strRefPlanName1, strRefPlanName2, strRefPlanNameMid, ref familyDoc);
		}

		private bool AddDimensionSectionPlan(string strRefPlanName1, string strRefPlanName2, string strParameterName, ref Autodesk.Revit.DB.Document familyDoc)
		{
			Autodesk.Revit.DB.View pView = this.FindElement(typeof(ViewPlan), HSFamily.m_strLevelSectionRefName, ref familyDoc) as Autodesk.Revit.DB.View;
			return this.AddDimension(pView, strRefPlanName1, strRefPlanName2, strParameterName, ref familyDoc);
		}

		private bool AddDimensionForeAverage(string strRefPlanName1, string strRefPlanName2, string strRefPlanNameMid, ref Autodesk.Revit.DB.Document familyDoc)
		{
			Autodesk.Revit.DB.View pView = this.FindElement(typeof(Autodesk.Revit.DB.View), HSFamily.m_strForeRefName, ref familyDoc) as Autodesk.Revit.DB.View;
			return this.AddDimensionAverage(pView, strRefPlanName1, strRefPlanName2, strRefPlanNameMid, ref familyDoc);
		}

		private bool AddDimensionFore(string strRefPlanName1, string strRefPlanName2, string strParameterName, ref Autodesk.Revit.DB.Document familyDoc)
		{
			Autodesk.Revit.DB.View pView = this.FindElement(typeof(Autodesk.Revit.DB.View), HSFamily.m_strForeRefName, ref familyDoc) as Autodesk.Revit.DB.View;
			return this.AddDimension(pView, strRefPlanName1, strRefPlanName2, strParameterName, ref familyDoc);
		}

		private bool AddDimensionAverageForeElevation(string strRefPlanName, string strRefPlanNameMid, ref Autodesk.Revit.DB.Document familyDoc)
		{
			Autodesk.Revit.DB.View view = this.FindElement(typeof(Autodesk.Revit.DB.View), HSFamily.m_strForeRefName, ref familyDoc) as Autodesk.Revit.DB.View;
			bool flag = view == null;
			bool result;
			if (flag)
			{
				result = false;
			}
			else
			{
				ReferencePlane referencePlane = this.FindElement(typeof(ReferencePlane), strRefPlanName, ref familyDoc) as ReferencePlane;
				ReferencePlane referencePlane2 = this.FindElement(typeof(ReferencePlane), strRefPlanNameMid, ref familyDoc) as ReferencePlane;
				Level level = this.FindElement(typeof(Level), HSFamily.m_strLevelSectionRefName, ref familyDoc) as Level;
				bool flag2 = referencePlane == null || level == null || referencePlane2 == null;
				if (flag2)
				{
					result = false;
				}
				else
				{
					ReferenceArray referenceArray = new ReferenceArray();
					referenceArray.Append(UnifiedModified.GetReference(referencePlane));
					referenceArray.Append(level.PlaneReference());
					referenceArray.Append(UnifiedModified.GetReference(referencePlane2));
					XYZ bubbleEnd = referencePlane.BubbleEnd;
					XYZ xyz = new XYZ(bubbleEnd.X, bubbleEnd.Y, level.Elevation);
					Dimension dimension = familyDoc.FamilyCreate.NewDimension(view, Line.CreateBound(bubbleEnd, xyz), referenceArray);
					dimension.AreSegmentsEqual = true;
					result = true;
				}
			}
			return result;
		}

		private bool AddDimensionAverage(Autodesk.Revit.DB.View pView, string strRefPlanName1, string strRefPlanName2, string strRefPlanNameMid, ref Autodesk.Revit.DB.Document familyDoc)
		{
			bool flag = pView == null;
			bool result;
			if (flag)
			{
				result = false;
			}
			else
			{
				ReferencePlane referencePlane = this.FindElement(typeof(ReferencePlane), strRefPlanName1, ref familyDoc) as ReferencePlane;
				ReferencePlane referencePlane2 = this.FindElement(typeof(ReferencePlane), strRefPlanName2, ref familyDoc) as ReferencePlane;
				ReferencePlane referencePlane3 = this.FindElement(typeof(ReferencePlane), strRefPlanNameMid, ref familyDoc) as ReferencePlane;
				bool flag2 = referencePlane == null || referencePlane2 == null || referencePlane3 == null;
				if (flag2)
				{
					result = false;
				}
				else
				{
					ReferenceArray referenceArray = new ReferenceArray();
					referenceArray.Append(UnifiedModified.GetReference(referencePlane));
					referenceArray.Append(UnifiedModified.GetReference(referencePlane2));
					referenceArray.Append(UnifiedModified.GetReference(referencePlane3));
					XYZ xyz = referencePlane.BubbleEnd;
					XYZ xyz2 = referencePlane2.BubbleEnd;
					bool flag3 = strRefPlanName1 == HSFamily.m_strLeftRightCenRefName;
					if (flag3)
					{
						xyz = new XYZ(xyz.X, xyz2.Y, xyz2.Z);
					}
					else
					{
						bool flag4 = strRefPlanName1 == HSFamily.m_strForeBackCenRefName;
						if (flag4)
						{
							xyz = new XYZ(xyz2.X, xyz.Y, xyz2.Z);
						}
						else
						{
							bool flag5 = strRefPlanName1 == HSFamily.m_strLevelUpRefName;
							if (flag5)
							{
								xyz = new XYZ(xyz2.X, xyz2.Y, xyz.Z);
							}
							else
							{
								bool flag6 = strRefPlanName1 == HSFamily.m_strLevelRefName;
								if (flag6)
								{
									xyz = new XYZ(xyz2.X, xyz2.Y, xyz.Z);
								}
							}
						}
					}
					bool flag7 = strRefPlanName2 == HSFamily.m_strLeftRightCenRefName;
					if (flag7)
					{
						xyz2 = new XYZ(xyz2.X, xyz.Y, xyz.Z);
					}
					else
					{
						bool flag8 = strRefPlanName2 == HSFamily.m_strForeBackCenRefName;
						if (flag8)
						{
							xyz2 = new XYZ(xyz.X, xyz2.Y, xyz.Z);
						}
						else
						{
							bool flag9 = strRefPlanName2 == HSFamily.m_strLevelUpRefName;
							if (flag9)
							{
								xyz2 = new XYZ(xyz.X, xyz.Y, xyz2.Z);
							}
							else
							{
								bool flag10 = strRefPlanName2 == HSFamily.m_strLevelRefName;
								if (flag10)
								{
									xyz2 = new XYZ(xyz.X, xyz.Y, xyz2.Z);
								}
							}
						}
					}
					Dimension dimension = familyDoc.FamilyCreate.NewDimension(pView, Line.CreateBound(xyz, xyz2), referenceArray);
					dimension.AreSegmentsEqual = true;
					result = true;
				}
			}
			return result;
		}

		private bool AddDimensionLevel(string strRefPlanName, string strParameterName, ref Autodesk.Revit.DB.Document familyDoc)
		{
			Autodesk.Revit.DB.View view = this.FindElement(typeof(Autodesk.Revit.DB.View), HSFamily.m_strForeRefName, ref familyDoc) as Autodesk.Revit.DB.View;
			bool flag = view == null;
			bool result;
			if (flag)
			{
				result = false;
			}
			else
			{
				ReferencePlane referencePlane = this.FindElement(typeof(ReferencePlane), strRefPlanName, ref familyDoc) as ReferencePlane;
				Level level = this.FindElement(typeof(Level), HSFamily.m_strLevelRefName, ref familyDoc) as Level;
				bool flag2 = referencePlane == null || level == null;
				if (flag2)
				{
					result = false;
				}
				else
				{
					ReferenceArray referenceArray = new ReferenceArray();
					referenceArray.Append(UnifiedModified.GetReference(referencePlane));
					referenceArray.Append(level.PlaneReference());
					XYZ xyz = new XYZ(referencePlane.FreeEnd.X, referencePlane.FreeEnd.Y, level.Elevation);
					Dimension dimension = familyDoc.FamilyCreate.NewDimension(view, Line.CreateBound(referencePlane.FreeEnd, xyz), referenceArray);
					dimension.FamilyLabel = familyDoc.FamilyManager.get_Parameter(strParameterName);
					result = true;
				}
			}
			return result;
		}

		private bool AddDimensionLevelUp(string strRefPlanName, string strParameterName, ref Autodesk.Revit.DB.Document familyDoc)
		{
			Autodesk.Revit.DB.View view = this.FindElement(typeof(Autodesk.Revit.DB.View), HSFamily.m_strForeRefName, ref familyDoc) as Autodesk.Revit.DB.View;
			bool flag = view == null;
			bool result;
			if (flag)
			{
				result = false;
			}
			else
			{
				ReferencePlane referencePlane = this.FindElement(typeof(ReferencePlane), strRefPlanName, ref familyDoc) as ReferencePlane;
				Level level = this.FindElement(typeof(Level), HSFamily.m_strLevelUpRefName, ref familyDoc) as Level;
				bool flag2 = referencePlane == null || level == null;
				if (flag2)
				{
					result = false;
				}
				else
				{
					ReferenceArray referenceArray = new ReferenceArray();
					referenceArray.Append(UnifiedModified.GetReference(referencePlane));
					referenceArray.Append(level.PlaneReference());
					XYZ xyz = new XYZ(0.0, 0.0, referencePlane.FreeEnd.Z);
					XYZ xyz2 = new XYZ(0.0, 0.0, level.Elevation);
					Dimension dimension = familyDoc.FamilyCreate.NewDimension(view, Line.CreateBound(xyz, xyz2), referenceArray);
					dimension.FamilyLabel = familyDoc.FamilyManager.get_Parameter(strParameterName);
					result = true;
				}
			}
			return result;
		}

		private bool AddDimensionTopR(string strRefPlanName, string strRefPlanName1, string strParameterName, ref Autodesk.Revit.DB.Document familyDoc)
		{
			Autodesk.Revit.DB.View view = this.FindElement(typeof(Autodesk.Revit.DB.View), HSFamily.m_strForeRefName, ref familyDoc) as Autodesk.Revit.DB.View;
			bool flag = view == null;
			bool result;
			if (flag)
			{
				result = false;
			}
			else
			{
				ReferencePlane referencePlane = this.FindElement(typeof(ReferencePlane), strRefPlanName, ref familyDoc) as ReferencePlane;
				ReferencePlane referencePlane2 = this.FindElement(typeof(ReferencePlane), strRefPlanName1, ref familyDoc) as ReferencePlane;
				bool flag2 = referencePlane == null || referencePlane2 == null;
				if (flag2)
				{
					result = false;
				}
				else
				{
					ReferenceArray referenceArray = new ReferenceArray();
					referenceArray.Append(UnifiedModified.GetReference(referencePlane));
					referenceArray.Append(UnifiedModified.GetReference(referencePlane2));
					XYZ xyz = new XYZ(0.0, 0.0, referencePlane.FreeEnd.Z);
					XYZ xyz2 = new XYZ(0.0, 0.0, referencePlane2.FreeEnd.Z);
					Dimension dimension = familyDoc.FamilyCreate.NewDimension(view, Line.CreateBound(xyz, xyz2), referenceArray);
					dimension.FamilyLabel = familyDoc.FamilyManager.get_Parameter(strParameterName);
					result = true;
				}
			}
			return result;
		}

		private bool AddDimensionLeftRight(string strRefPlanName, string strParameterName, ref Autodesk.Revit.DB.Document familyDoc)
		{
			Autodesk.Revit.DB.View view = this.FindElement(typeof(ViewPlan), HSFamily.m_strLevelRefName, ref familyDoc) as Autodesk.Revit.DB.View;
			bool flag = view == null;
			bool result;
			if (flag)
			{
				result = false;
			}
			else
			{
				ReferencePlane referencePlane = this.FindElement(typeof(ReferencePlane), strRefPlanName, ref familyDoc) as ReferencePlane;
				ReferencePlane referencePlane2 = this.FindElement(typeof(ReferencePlane), HSFamily.m_strLeftRightCenRefName, ref familyDoc) as ReferencePlane;
				bool flag2 = referencePlane == null || referencePlane2 == null;
				if (flag2)
				{
					result = false;
				}
				else
				{
					ReferenceArray referenceArray = new ReferenceArray();
					referenceArray.Append(UnifiedModified.GetReference(referencePlane));
					referenceArray.Append(UnifiedModified.GetReference(referencePlane2));
					XYZ xyz = new XYZ(referencePlane2.FreeEnd.X, referencePlane.FreeEnd.Y, referencePlane.FreeEnd.Z);
					Dimension dimension = familyDoc.FamilyCreate.NewDimension(view, Line.CreateBound(referencePlane.FreeEnd, xyz), referenceArray);
					dimension.FamilyLabel = familyDoc.FamilyManager.get_Parameter(strParameterName);
					result = true;
				}
			}
			return result;
		}

		private bool AddDimensionForeBack(string strRefPlanName, string strParameterName, ref Autodesk.Revit.DB.Document familyDoc)
		{
			Autodesk.Revit.DB.View view = this.FindElement(typeof(ViewPlan), HSFamily.m_strLevelRefName, ref familyDoc) as Autodesk.Revit.DB.View;
			bool flag = view == null;
			bool result;
			if (flag)
			{
				result = false;
			}
			else
			{
				ReferencePlane referencePlane = this.FindElement(typeof(ReferencePlane), strRefPlanName, ref familyDoc) as ReferencePlane;
				ReferencePlane referencePlane2 = this.FindElement(typeof(ReferencePlane), HSFamily.m_strForeBackCenRefName, ref familyDoc) as ReferencePlane;
				bool flag2 = referencePlane == null || referencePlane2 == null;
				if (flag2)
				{
					result = false;
				}
				else
				{
					ReferenceArray referenceArray = new ReferenceArray();
					referenceArray.Append(UnifiedModified.GetReference(referencePlane));
					referenceArray.Append(UnifiedModified.GetReference(referencePlane2));
					XYZ xyz = new XYZ(referencePlane.FreeEnd.X, referencePlane2.FreeEnd.Y, referencePlane.FreeEnd.Z);
					Dimension dimension = familyDoc.FamilyCreate.NewDimension(view, Line.CreateBound(referencePlane.FreeEnd, xyz), referenceArray);
					dimension.FamilyLabel = familyDoc.FamilyManager.get_Parameter(strParameterName);
					result = true;
				}
			}
			return result;
		}

		private bool AddDimension(Autodesk.Revit.DB.View pView, string strRefPlanName1, string strRefPlanName2, string strParameterName, ref Autodesk.Revit.DB.Document familyDoc)
		{
			bool flag = pView == null;
			bool result;
			if (flag)
			{
				result = false;
			}
			else
			{
				bool flag2 = strRefPlanName1 == HSFamily.m_strLeftRightCenRefName;
				if (flag2)
				{
					result = this.AddDimensionLeftRight(strRefPlanName2, strParameterName, ref familyDoc);
				}
				else
				{
					bool flag3 = strRefPlanName1 == HSFamily.m_strForeBackCenRefName;
					if (flag3)
					{
						result = this.AddDimensionForeBack(strRefPlanName2, strParameterName, ref familyDoc);
					}
					else
					{
						bool flag4 = strRefPlanName1 == HSFamily.m_strLevelUpRefName;
						if (flag4)
						{
							result = this.AddDimensionLevelUp(strRefPlanName2, strParameterName, ref familyDoc);
						}
						else
						{
							bool flag5 = strRefPlanName1 == HSFamily.m_strLevelRefName;
							if (flag5)
							{
								result = this.AddDimensionLevel(strRefPlanName2, strParameterName, ref familyDoc);
							}
							else
							{
								bool flag6 = strRefPlanName2 == HSFamily.m_strLeftRightCenRefName;
								if (flag6)
								{
									result = this.AddDimensionLeftRight(strRefPlanName1, strParameterName, ref familyDoc);
								}
								else
								{
									bool flag7 = strRefPlanName2 == HSFamily.m_strForeBackCenRefName;
									if (flag7)
									{
										result = this.AddDimensionForeBack(strRefPlanName1, strParameterName, ref familyDoc);
									}
									else
									{
										bool flag8 = strRefPlanName2 == HSFamily.m_strLevelUpRefName;
										if (flag8)
										{
											result = this.AddDimensionLevelUp(strRefPlanName1, strParameterName, ref familyDoc);
										}
										else
										{
											bool flag9 = strRefPlanName2 == HSFamily.m_strLevelRefName;
											if (flag9)
											{
												result = this.AddDimensionLevel(strRefPlanName1, strParameterName, ref familyDoc);
											}
											else
											{
												ReferencePlane referencePlane = this.FindElement(typeof(ReferencePlane), strRefPlanName1, ref familyDoc) as ReferencePlane;
												ReferencePlane referencePlane2 = this.FindElement(typeof(ReferencePlane), strRefPlanName2, ref familyDoc) as ReferencePlane;
												bool flag10 = referencePlane == null || referencePlane2 == null;
												if (flag10)
												{
													result = false;
												}
												else
												{
													ReferenceArray referenceArray = new ReferenceArray();
													referenceArray.Append(UnifiedModified.GetReference(referencePlane));
													referenceArray.Append(UnifiedModified.GetReference(referencePlane2));
													Dimension dimension = familyDoc.FamilyCreate.NewDimension(pView, Line.CreateBound(referencePlane.FreeEnd, referencePlane2.FreeEnd), referenceArray);
													dimension.FamilyLabel = familyDoc.FamilyManager.get_Parameter(strParameterName);
													result = true;
												}
											}
										}
									}
								}
							}
						}
					}
				}
			}
			return result;
		}

		private bool CreateSectionFamilyElements(string strType, ref Autodesk.Revit.DB.Document familyDoc)
		{
			double num = 300.0;
			double num2 = 500.0;
			double num3 = 20.0;
			double num4 = 50.0;
			bool flag = strType == "A" || strType == "Y";
			if (flag)
			{
				num2 = num;
			}
			this.AddReferencePlaneX(num / 2.0, "Right", ref familyDoc);
			this.AddReferencePlaneX(-num / 2.0, "Left", ref familyDoc);
			this.AddReferencePlaneX(num / 2.0 - num3, "RightIN", ref familyDoc);
			this.AddReferencePlaneX(-num / 2.0 + num3, "LeftIN", ref familyDoc);
			this.AddReferencePlaneY(num2 / 2.0, "Back", ref familyDoc);
			this.AddReferencePlaneY(-num2 / 2.0, "Front", ref familyDoc);
			this.AddReferencePlaneY(num2 / 2.0 - num3, "BackIN", ref familyDoc);
			this.AddReferencePlaneY(-num2 / 2.0 + num3, "FrontIN", ref familyDoc);
			this.AddReferencePlaneX(num4 / 2.0, "MidRight", ref familyDoc);
			this.AddReferencePlaneX(-num4 / 2.0, "MidLeft", ref familyDoc);
			double num5 = (num2 - num3 * 2.0) * 1.0 / 2.0;
			this.AddReferencePlaneY(num5 / 2.0, "CBackHigh", ref familyDoc);
			this.AddReferencePlaneY(-num5 / 2.0, "CFrontHigh", ref familyDoc);
			this.AddParameters("Wide", num, ref familyDoc, false);
			this.AddParameters("High", num2, ref familyDoc, false);
			this.AddParameters("Thick", num3, ref familyDoc, false);
			this.AddParameters("ThickMid", num4, ref familyDoc, false);
			FamilyParameter familyParameter = this.AddParametersNoMainSize("CHigh", num5, ref familyDoc, true);
			familyDoc.FamilyManager.SetFormula(familyParameter, "(High-Thick*2)/2");
			this.CreateSectionLines(strType, num, num2, num3, num4, ref familyDoc);
			SubTransaction subTransaction = new SubTransaction(familyDoc);
			subTransaction.Start();
			this.AddDimensionSectionPlan("MidLeft", "MidRight", "ThickMid", ref familyDoc);
			this.AddDimensionSectionPlanAverage("MidLeft", "MidRight", HSFamily.m_strLeftRightCenRefName, ref familyDoc);
			this.AddDimensionSectionPlan("Right", "Left", "Wide", ref familyDoc);
			this.AddDimensionSectionPlanAverage("Right", "Left", HSFamily.m_strLeftRightCenRefName, ref familyDoc);
			this.AddDimensionSectionPlan("Right", "RightIN", "Thick", ref familyDoc);
			this.AddDimensionSectionPlan("Left", "LeftIN", "Thick", ref familyDoc);
			this.AddDimensionSectionPlan("Back", "Front", "High", ref familyDoc);
			this.AddDimensionSectionPlanAverage("Back", "Front", HSFamily.m_strForeBackCenRefName, ref familyDoc);
			this.AddDimensionSectionPlan("Back", "BackIN", "Thick", ref familyDoc);
			this.AddDimensionSectionPlan("Front", "FrontIN", "Thick", ref familyDoc);
			this.AddDimensionSectionPlan("CBackHigh", "CFrontHigh", "CHigh", ref familyDoc);
			this.AddDimensionSectionPlanAverage("CBackHigh", "CFrontHigh", HSFamily.m_strForeBackCenRefName, ref familyDoc);
			subTransaction.Commit();
			return true;
		}

		public bool CreateSectionLines(string strType, double dWide, double dHigh, double dThick, double dThickMid, ref Autodesk.Revit.DB.Document familyDoc)
		{
			XYZ basisX = XYZ.BasisX;
			XYZ basisY = XYZ.BasisY;
			XYZ xyz = basisX * HSFamily.mmToFeet(dThick);
			XYZ xyz2 = basisY * HSFamily.mmToFeet(dThick);
			XYZ xyz3 = basisX * HSFamily.mmToFeet(dWide / 2.0);
			XYZ xyz4 = basisY * HSFamily.mmToFeet(dHigh / 2.0);
			XYZ xyz5 = basisX * HSFamily.mmToFeet(dThickMid / 2.0);
			XYZ zero = XYZ.Zero;
			XYZ xyz6 = xyz4 - basisY * HSFamily.mmToFeet(dHigh - dThick * 2.0) / 4.0;
			List<XYZ> list = new List<XYZ>();
			bool flag = false;
			char c = strType[0];
			switch (c)
			{
			case 'A':
			case 'I':
				break;
			case 'B':
				list.Add(zero + xyz3 + xyz4);
				list.Add(zero - xyz3 + xyz4);
				list.Add(zero - xyz3 - xyz4);
				list.Add(zero - xyz3 - xyz4 + xyz);
				list.Add(zero - xyz3 + xyz4 + xyz - xyz2);
				list.Add(zero + xyz3 + xyz4 - xyz2);
				goto IL_5DC;
			case 'C':
				list.Add(zero + xyz3 + xyz4);
				list.Add(zero - xyz3 + xyz4);
				list.Add(zero - xyz3 - xyz4);
				list.Add(zero + xyz3 - xyz4);
				list.Add(zero + xyz3 - xyz4 + xyz2);
				list.Add(zero - xyz3 - xyz4 + xyz + xyz2);
				list.Add(zero - xyz3 + xyz4 + xyz - xyz2);
				list.Add(zero + xyz3 + xyz4 - xyz2);
				goto IL_5DC;
			case 'D':
			case 'G':
				list.Add(zero + xyz3 + xyz4);
				list.Add(zero - xyz3 + xyz4);
				list.Add(zero - xyz3 + xyz4 - xyz2);
				list.Add(zero - xyz5 + xyz4 - xyz2);
				list.Add(zero - xyz4 - xyz5 + xyz2);
				list.Add(zero - xyz3 - xyz4 + xyz2);
				list.Add(zero - xyz3 - xyz4);
				list.Add(zero + xyz3 - xyz4);
				list.Add(zero + xyz3 - xyz4 + xyz2);
				list.Add(zero - xyz4 + xyz5 + xyz2);
				list.Add(zero + xyz5 + xyz4 - xyz2);
				list.Add(zero + xyz3 + xyz4 - xyz2);
				goto IL_5DC;
			case 'E':
			case 'F':
				goto IL_3F5;
			case 'H':
				list.Add(zero + xyz3 + xyz4);
				list.Add(zero - xyz3 + xyz4);
				list.Add(zero - xyz3 - xyz4);
				list.Add(zero + xyz3 - xyz4);
				list.Add(zero + xyz3 - xyz4 + xyz6);
				list.Add(zero + xyz3 - xyz4 + xyz6 - xyz);
				list.Add(zero + xyz3 - xyz4 - xyz + xyz2);
				list.Add(zero - xyz3 - xyz4 + xyz + xyz2);
				list.Add(zero - xyz3 + xyz4 + xyz - xyz2);
				list.Add(zero + xyz3 + xyz4 - xyz - xyz2);
				list.Add(zero + xyz3 + xyz4 - xyz - xyz6);
				list.Add(zero + xyz3 + xyz4 - xyz6);
				goto IL_5DC;
			default:
				if (c != 'Y')
				{
					if (c != 'Z')
					{
						return false;
					}
					goto IL_3F5;
				}
				break;
			}
			flag = true;
			goto IL_5DC;
			IL_3F5:
			list.Add(zero + xyz3 + xyz4);
			list.Add(zero - xyz3 + xyz4);
			list.Add(zero - xyz3 - xyz4);
			list.Add(zero + xyz3 - xyz4);
			IL_5DC:
			Autodesk.Revit.DB.View view = this.FindElement(typeof(ViewPlan), HSFamily.m_strLevelSectionRefName, ref familyDoc) as Autodesk.Revit.DB.View;
			bool flag2 = flag;
			bool result;
			if (flag2)
			{
				xyz3 = basisX * HSFamily.mmToFeet(dWide / 2.0);
				xyz4 = basisY * HSFamily.mmToFeet(dWide / 2.0);
				XYZ xyz7 = zero + xyz4;
				XYZ xyz8 = zero - xyz4;
				XYZ xyz9 = zero + xyz3;
				XYZ xyz10 = zero - xyz3;
				familyDoc.FamilyCreate.NewDetailCurve(view, Arc.Create(xyz9, xyz10, xyz7));
				familyDoc.FamilyCreate.NewDetailCurve(view, Arc.Create(xyz10, xyz9, xyz8));
				bool flag3 = strType == "I";
				if (flag3)
				{
					xyz3 = basisX * HSFamily.mmToFeet(dWide / 2.0 - dThick);
					xyz4 = basisY * HSFamily.mmToFeet(dWide / 2.0 - dThick);
					xyz7 = zero + xyz4;
					xyz8 = zero - xyz4;
					xyz9 = zero + xyz3;
					xyz10 = zero - xyz3;
					familyDoc.FamilyCreate.NewDetailCurve(view, Arc.Create(xyz9, xyz10, xyz7));
					familyDoc.FamilyCreate.NewDetailCurve(view, Arc.Create(xyz10, xyz9, xyz8));
				}
				result = true;
			}
			else
			{
				bool flag4 = list.Count<XYZ>() == 0;
				if (flag4)
				{
					result = false;
				}
				else
				{
					list.Add(list[0]);
					for (int i = 0; i < list.Count<XYZ>() - 1; i++)
					{
						familyDoc.FamilyCreate.NewDetailCurve(view, Line.CreateBound(list[i], list[i + 1]));
					}
					result = true;
				}
			}
			return result;
		}

		public bool LoadSectionFamily(ref Family hsFamilyCur, ref FamilySymbol symbolHor, ref FamilySymbol symbolVer, ref FamilySymbol symbolLean, string strSectionType, Autodesk.Revit.DB.Document doc)
		{
			string sectionFamilyName = this.GetSectionFamilyName(strSectionType);
			bool flag = !this.LoadFamily(ref hsFamilyCur, sectionFamilyName, doc);
			bool result;
			if (flag)
			{
				result = false;
			}
			else
			{
				List<FamilySymbol> symbols = hsFamilyCur.GetSymbols();
				foreach (FamilySymbol familySymbol in symbols)
				{
					FamilySymbol familySymbol2 = familySymbol;
					bool flag2 = familySymbol2.Name.Contains("水平");
					if (flag2)
					{
						symbolHor = familySymbol2;
					}
					else
					{
						bool flag3 = familySymbol2.Name.Contains("竖直");
						if (flag3)
						{
							symbolVer = familySymbol2;
						}
						else
						{
							bool flag4 = familySymbol2.Name.Contains("倾斜");
							if (flag4)
							{
								symbolLean = familySymbol2;
							}
						}
					}
				}
				result = true;
			}
			return result;
		}

		public bool LoadSectionFamily(ref Family hsFamilyCur, ref FamilySymbol symbolCur, int nSymbolType, string strSectionType, Autodesk.Revit.DB.Document doc)
		{
			FamilySymbol familySymbol = null;
			FamilySymbol familySymbol2 = null;
			FamilySymbol familySymbol3 = null;
			bool flag = !this.LoadSectionFamily(ref hsFamilyCur, ref familySymbol, ref familySymbol2, ref familySymbol3, strSectionType, doc);
			bool result;
			if (flag)
			{
				result = false;
			}
			else
			{
				bool flag2 = nSymbolType == 0;
				if (flag2)
				{
					symbolCur = familySymbol;
				}
				else
				{
					bool flag3 = nSymbolType == 1;
					if (flag3)
					{
						symbolCur = familySymbol2;
					}
					else
					{
						bool flag4 = nSymbolType == 2;
						if (flag4)
						{
							symbolCur = familySymbol3;
						}
					}
				}
				result = true;
			}
			return result;
		}

		public bool LoadFamily(ref Family hsFamilyCur, string strFamilyName, bool isTran = true)
		{
			bool result;
			if (isTran)
			{
				Transaction transaction = new Transaction(this.m_doc);
				transaction.Start("familyLoad");
				result = this.LoadFamily(ref hsFamilyCur, strFamilyName, this.m_doc);
				transaction.Commit();
			}
			else
			{
				result = this.LoadFamily(ref hsFamilyCur, strFamilyName, this.m_doc);
			}
			return result;
		}

		public bool LoadFamily(ref Family hsFamilyCur, string strFamilyName, Autodesk.Revit.DB.Document doc)
		{
			string text = this.m_strHSFamilyDir;
			text += strFamilyName;
			text += HSFamily.m_strSuffixFamilyFile;
			bool flag = !File.Exists(text);
			return !flag && this.LoadFamily(ref hsFamilyCur, strFamilyName, text, doc);
		}

		public bool LoadFamily(ref Family hsFamilyCur, string strFamilyName, string strFamilyFilePath, Autodesk.Revit.DB.Document doc)
		{
			bool flag = HSFamily.IsFamilyIsLoaded(ref hsFamilyCur, strFamilyName, doc);
			bool result;
			if (flag)
			{
				result = true;
			}
			else
			{
				try
				{
					Family family = null;
					doc.LoadFamily(strFamilyFilePath, out family);
					hsFamilyCur = family;
				}
				catch (Exception ex)
				{
					Utils.MessageBox(ex.Message);
					return false;
				}
				result = true;
			}
			return result;
		}

		public static bool IsFamilyIsLoaded(ref Family hsFamilyCur, string strFamilyName, Autodesk.Revit.DB.Document doc)
		{
			IList<Element> list = new FilteredElementCollector(doc).OfClass(typeof(Family)).ToElements();
			hsFamilyCur = null;
			foreach (Element element in list)
			{
				Family family = (Family)element;
				bool flag = family.Name.ToUpper().Trim().StartsWith(strFamilyName.ToUpper());
				if (flag)
				{
					hsFamilyCur = family;
					return true;
				}
			}
			return false;
		}

		public bool IsFamilyIsLoaded(ref Family hsFamilyCur, string strFamilyName)
		{
			return HSFamily.IsFamilyIsLoaded(ref hsFamilyCur, strFamilyName, this.m_doc);
		}

		public bool IsReferencePlaneExist(string strName, ref Autodesk.Revit.DB.Document familyDoc)
		{
			ReferencePlane referencePlane = null;
			return this.IsReferencePlaneExist(ref referencePlane, strName, ref familyDoc);
		}

		public bool IsReferencePlaneExist(ref ReferencePlane viewGet, string strName, ref Autodesk.Revit.DB.Document familyDoc)
		{
			viewGet = null;
			List<Element> list = new List<Element>();
			ElementClassFilter elementClassFilter = new ElementClassFilter(typeof(ReferencePlane));
			ElementClassFilter elementClassFilter2 = new ElementClassFilter(typeof(Autodesk.Revit.DB.View));
			LogicalOrFilter logicalOrFilter = new LogicalOrFilter(elementClassFilter, elementClassFilter2);
			FilteredElementCollector filteredElementCollector = new FilteredElementCollector(familyDoc);
			list.AddRange(filteredElementCollector.WherePasses(logicalOrFilter).ToElements());
			foreach (Element element in list)
			{
				Autodesk.Revit.DB.View view = element as Autodesk.Revit.DB.View;
				bool flag = view != null && view.IsTemplate;
				if (!flag)
				{
					bool flag2 = strName == element.Name;
					if (flag2)
					{
						viewGet = (element as ReferencePlane);
						return true;
					}
				}
			}
			return false;
		}

		public ReferencePlane AddReferencePlaneX(double dX, string strName, ref Autodesk.Revit.DB.Document familyDoc)
		{
			bool flag = this.IsReferencePlaneExist(strName, ref familyDoc);
			ReferencePlane result;
			if (flag)
			{
				result = null;
			}
			else
			{
				dX = HSFamily.mmToFeet(dX);
				Autodesk.Revit.DB.View view = this.FindElement(typeof(ViewPlan), HSFamily.m_strLevelRefName, ref familyDoc) as Autodesk.Revit.DB.View;
				double num = HSFamily.mmToFeet(3000.0);
				XYZ xyz = new XYZ(dX, -num, 0.0);
				XYZ xyz2 = new XYZ(dX, num, 0.0);
				ReferencePlane referencePlane = familyDoc.FamilyCreate.NewReferencePlane(xyz, xyz2, XYZ.BasisZ, view);
				referencePlane.Name = strName;
				result = referencePlane;
			}
			return result;
		}

		public ReferencePlane AddReferencePlaneY(double dY, string strName, ref Autodesk.Revit.DB.Document familyDoc)
		{
			bool flag = this.IsReferencePlaneExist(strName, ref familyDoc);
			ReferencePlane result;
			if (flag)
			{
				result = null;
			}
			else
			{
				dY = HSFamily.mmToFeet(dY);
				Autodesk.Revit.DB.View view = this.FindElement(typeof(ViewPlan), HSFamily.m_strLevelRefName, ref familyDoc) as Autodesk.Revit.DB.View;
				double num = HSFamily.mmToFeet(3000.0);
				XYZ xyz = new XYZ(-num, dY, 0.0);
				XYZ xyz2 = new XYZ(num, dY, 0.0);
				ReferencePlane referencePlane = familyDoc.FamilyCreate.NewReferencePlane(xyz, xyz2, XYZ.BasisZ, view);
				referencePlane.Name = strName;
				result = referencePlane;
			}
			return result;
		}

		public ReferencePlane AddReferencePlaneZ(double dZ, string strName, ref Autodesk.Revit.DB.Document familyDoc)
		{
			bool flag = this.IsReferencePlaneExist(strName, ref familyDoc);
			ReferencePlane result;
			if (flag)
			{
				result = null;
			}
			else
			{
				dZ = HSFamily.mmToFeet(dZ);
				Autodesk.Revit.DB.View view = this.FindElement(typeof(ViewPlan), HSFamily.m_strLevelRefName, ref familyDoc) as Autodesk.Revit.DB.View;
				double num = HSFamily.mmToFeet(1000.0);
				XYZ xyz = new XYZ(-num, 0.0, dZ);
				XYZ xyz2 = new XYZ(num, 0.0, dZ);
				ReferencePlane referencePlane = familyDoc.FamilyCreate.NewReferencePlane(xyz, xyz2, XYZ.BasisY, view);
				referencePlane.Name = strName;
				result = referencePlane;
			}
			return result;
		}

		private Element FindElement(Type targetType, string targetName, ref Autodesk.Revit.DB.Document familyDoc)
		{
			FilteredElementCollector filteredElementCollector = new FilteredElementCollector(familyDoc);
			filteredElementCollector.WherePasses(new ElementClassFilter(targetType));
			IEnumerable<Element> source = from element in filteredElementCollector
			where element.Name.Equals(targetName)
			select element;
			List<Element> list = source.ToList<Element>();
			bool flag = list.Count > 0;
			Element result;
			if (flag)
			{
				result = list[0];
			}
			else
			{
				result = null;
			}
			return result;
		}

		private Autodesk.Revit.DB.View FindPlan(string targetName, ViewType viewType, ref Autodesk.Revit.DB.Document familyDoc)
		{
			FilteredElementCollector filteredElementCollector = new FilteredElementCollector(familyDoc);
			filteredElementCollector.WherePasses(new ElementClassFilter(typeof(Autodesk.Revit.DB.View)));
			IEnumerable<Element> source = from element in filteredElementCollector
			where element.Name.Equals(targetName)
			select element;
			List<Element> list = source.ToList<Element>();
			foreach (Element element2 in list)
			{
				Autodesk.Revit.DB.View view = (Autodesk.Revit.DB.View)element2;
				bool flag = view.ViewType == viewType;
				if (flag)
				{
					return view;
				}
			}
			return null;
		}

		private FamilyParameter AddParametersByGroup(string strName, double dVal, ref Autodesk.Revit.DB.Document familyDoc, BuiltInParameterGroup parameterGroup = (BuiltInParameterGroup)(-5000101), bool bInstancePar = true, bool bChangetoFeet = true)
		{
			FamilyManager familyManager = familyDoc.FamilyManager;
			FamilyParameter familyParameter = familyManager.get_Parameter(strName);
			bool flag = familyParameter == null;
			if (flag)
			{
				familyParameter = familyManager.AddParameter(strName, parameterGroup, (Autodesk.Revit.DB.ParameterType)4, bInstancePar);
			}
			if (bChangetoFeet)
			{
				dVal = HSFamily.mmToFeet(dVal);
			}
			try
			{
				familyManager.Set(familyParameter, dVal);
			}
			catch (Exception ex)
			{
				Utils.MessageBox(ex.Message);
				return null;
			}
			return familyParameter;
		}

		private FamilyParameter AddParametersByGroup(string strName, int nVal, ref Autodesk.Revit.DB.Document familyDoc, BuiltInParameterGroup parameterGroup = (BuiltInParameterGroup)(-5000101), bool bInstancePar = true)
		{
			FamilyManager familyManager = familyDoc.FamilyManager;
			FamilyParameter familyParameter = familyManager.get_Parameter(strName);
			bool flag = familyParameter == null;
			if (flag)
			{
				familyParameter = familyManager.AddParameter(strName, parameterGroup, (Autodesk.Revit.DB.ParameterType)2, bInstancePar);
			}
			try
			{
				familyManager.Set(familyParameter, nVal);
			}
			catch (Exception ex)
			{
				Utils.MessageBox(ex.Message);
				return null;
			}
			return familyParameter;
		}

		private FamilyParameter AddParametersByGroup(string strName, string strVal, ref Autodesk.Revit.DB.Document familyDoc, BuiltInParameterGroup parameterGroup = (BuiltInParameterGroup)(-5000101), bool bInstancePar = true)
		{
			FamilyManager familyManager = familyDoc.FamilyManager;
			FamilyParameter familyParameter = familyManager.get_Parameter(strName);
			bool flag = familyParameter == null;
			if (flag)
			{
				familyParameter = familyManager.AddParameter(strName, parameterGroup, (Autodesk.Revit.DB.ParameterType)1, bInstancePar);
			}
			try
			{
				familyManager.Set(familyParameter, strVal);
			}
			catch (Exception ex)
			{
				Utils.MessageBox(ex.Message);
				return null;
			}
			return familyParameter;
		}

		private FamilyParameter AddParametersByGroup(string strName, bool bVal, ref Autodesk.Revit.DB.Document familyDoc, BuiltInParameterGroup parameterGroup = (BuiltInParameterGroup)(-5000101), bool bInstancePar = true)
		{
			FamilyManager familyManager = familyDoc.FamilyManager;
			FamilyParameter familyParameter = familyManager.get_Parameter(strName);
			bool flag = familyParameter == null;
			if (flag)
			{
				familyParameter = familyManager.AddParameter(strName, parameterGroup, (Autodesk.Revit.DB.ParameterType)10, bInstancePar);
			}
			try
			{
				int num = bVal ? 1 : 0;
				familyManager.Set(familyParameter, num);
			}
			catch (Exception ex)
			{
				Utils.MessageBox(ex.Message);
				return null;
			}
			return familyParameter;
		}

		private FamilyParameter AddMaterialParameter(string strName, ref Autodesk.Revit.DB.Document familyDoc, bool bInstancePar = true)
		{
			FamilyManager familyManager = familyDoc.FamilyManager;
			FamilyParameter familyParameter = familyManager.get_Parameter(strName);
			bool flag = familyParameter == null;
			if (flag)
			{
				familyParameter = familyManager.AddParameter(strName, BuiltInParameterGroup.PG_MATERIALS, (Autodesk.Revit.DB.ParameterType)9, bInstancePar);
			}
			return familyParameter;
		}

		private FamilyParameter AddParameters(string strName, double dVal, ref Autodesk.Revit.DB.Document familyDoc, bool bInstancePar = true)
		{
			return this.AddParametersByGroup(strName, dVal, ref familyDoc, (Autodesk.Revit.DB.BuiltInParameterGroup)(-5000101), bInstancePar, true);
		}

		private FamilyParameter AddParametersNoMainSize(string strName, double dVal, ref Autodesk.Revit.DB.Document familyDoc, bool bInstancePar = true)
		{
			return this.AddParametersByGroup(strName, dVal, ref familyDoc, (Autodesk.Revit.DB.BuiltInParameterGroup)(-5000104), bInstancePar, true);
		}

		public FamilySymbol GetFamilySymbolByName(string familyName, string symbolName)
		{
			FamilySymbol result = null;
			FilteredElementCollector filteredElementCollector = new FilteredElementCollector(this.m_doc);
			IList<Element> list = filteredElementCollector.OfClass(typeof(Family)).ToElements();
			foreach (Element element in list)
			{
				Family family = element as Family;
				bool flag = family == null;
				if (!flag)
				{
					bool flag2 = familyName.ToUpper().CompareTo(family.Name.ToUpper()) != 0;
					if (!flag2)
					{
						List<FamilySymbol> symbols = family.GetSymbols();
						foreach (FamilySymbol familySymbol in symbols)
						{
							bool flag3 = symbolName.ToUpper().CompareTo(familySymbol.Name.ToUpper()) == 0;
							if (flag3)
							{
								return familySymbol;
							}
						}
					}
				}
			}
			return result;
		}

		public static FamilySymbol GetFamilySymbolDefault(Family familyIn)
		{
			List<FamilySymbol> symbols = familyIn.GetSymbols();
			using (List<FamilySymbol>.Enumerator enumerator = symbols.GetEnumerator())
			{
				if (enumerator.MoveNext())
				{
					return enumerator.Current;
				}
			}
			return null;
		}

		public bool CreateHSInstanceTest(HSDefineInfo hsDef)
		{
			string familyName = "";
			string symbolName = "";
			hsDef.GetHSFamilyName(ref familyName, ref symbolName, this.m_uiApp);
			FamilySymbol familySymbolByName = this.GetFamilySymbolByName(familyName, symbolName);
			bool flag = familySymbolByName == null;
			bool result;
			if (flag)
			{
				result = false;
			}
			else
			{
				this.m_uiApp.ActiveUIDocument.PromptForFamilyInstancePlacement(familySymbolByName);
				result = true;
			}
			return result;
		}

		private UIApplication m_uiApp;

        private Autodesk.Revit.DB.Document m_doc;

		private Selection m_selection;

        private Autodesk.Revit.ApplicationServices.Application m_revit;

		private string m_strFamilyTemplatePath;

		private string m_strSectionTemplatePath;

		private string m_strHSFamilyDir;

		private string m_strLabelTemplatePath;

		private static string m_strLabelTemplateName = "HSLabelTemplate.rfa";

		public static string m_strHSTemplateName = "\\公制常规模型.rft";

		public static string m_strSectionTemplateName = "\\公制轮廓.rft";

		public static string m_strLevelSectionRefName = "参照标高";

		public static string m_strLevelRefName = HSFamily.m_strLevelSectionRefName;

		public static string m_strLevelUpRefName = HSFamily.m_strLevelSectionRefName;

		public static string m_strPlanRefName = "参照平面";

		public static string m_strForeRefName = "前";

		public static string m_strLeftRightCenRefName = "中心(左/右)";

		public static string m_strForeBackCenRefName = "中心(前/后)";

		public static string m_strSuffixFamilyFile = ".rfa";

		public static string m_strMaterialCZ = "支吊架材质";

		public static string m_strTunnelHeight = "舱室净高";

		public static string m_strOffsetHigh = "根部高度";

		public static string m_strNetHigh = "高";

		private double m_dElevationLevelUp;

		private double dHorB = 100.0;

		private double dHorH = 200.0;

		private double dHorT = 20.0;

		private double dHorM = 20.0;
	}
}
